[sip-comm-dev] Re: svn commit: r5179 - trunk: resources/languages src/net/java/sip/communicator/impl/gui/main/account


#1

Clicking the advanced button of the simple account registration dialog
while the value of the Network combo is "select network" now throws a
NullPointerException.

Steps to reproduce:
1. Invoke File > Add new account from the main menu of the application.
2. The value of the Network combo should be "select network" at this
point so click the Advanced button at the bottom left of the dialog.

What happens:
- A NullPointerException stack trace is printed in Command Prompt.
- The fact is that the Advanced and Add buttons are always enabled.

What is expected to happen:
- The Advanced button should be disabled until I select an actual
network because the advanced account registration wizard doesn't allow
me to select the network.
- The Add button should be disabled until I select an actual work (and
provide some input in the network-specific fields for that matter but
I guess it may be too hard to implement).

···

On Sat, Mar 28, 2009 at 1:45 PM, <emcho@dev.java.net> wrote:

Author: emcho
Date: 2009-03-28 10:45:55+0000
New Revision: 5179

Added:
trunk/src/net/java/sip/communicator/impl/gui/main/account/EmptyAccountRegistrationWizard.java
trunk/src/net/java/sip/communicator/impl/gui/main/account/EmptyAccountRegistrationWizardPage.java
Modified:
trunk/resources/languages/resources.properties
trunk/src/net/java/sip/communicator/impl/gui/main/account/AccountRegSummaryPage.java
trunk/src/net/java/sip/communicator/impl/gui/main/account/NewAccountDialog.java

Log:
Fixes issue #538 : Add Account wizard's protocol combo should be empty by default. The "Add Account" wizard will now open without a selected default protocol and instead it would open a page prompting the user to select a network.

Modified: trunk/resources/languages/resources.properties
Url: https://sip-communicator.dev.java.net/source/browse/sip-communicator/trunk/resources/languages/resources.properties?view=diff&rev=5179&p1=trunk/resources/languages/resources.properties&p2=trunk/resources/languages/resources.properties&r1=5178&r2=5179

--- trunk/resources/languages/resources.properties (original)
+++ trunk/resources/languages/resources.properties 2009-03-28 10:45:55+0000
@@ -350,6 +350,12 @@
impl.swingnotification.POPUP_MESSAGE_HANDLER=SIP Communicator popups
impl.growlnotification.POPUP_MESSAGE_HANDLER=Growl notifications

+# New Account Dialog
+impl.gui.main.account.DEFAULT_PAGE_TITLE=Select Network
+impl.gui.main.account.DEFAULT_PAGE_BODY=You can use the list above to select the network that you would like to add an account for.
+impl.gui.main.account.DUMMY_PROTOCOL_NAME=select network
+impl.gui.main.account.DUMMY_PROTOCOL_DESCRIPTION=select network
+
# account info
plugin.accountinfo.TITLE=Account Info
plugin.accountinfo.BROWSE=Browse
@@ -378,7 +384,7 @@
plugin.aimaccregwizz.PROTOCOL_NAME=AIM
plugin.aimaccregwizz.PROTOCOL_DESCRIPTION=The AIM service protocol
plugin.aimaccregwizz.USERNAME=AIM Screenname:
-plugin.aimaccregwizz.USERNAME_AND_PASSWORD=UIN and Password
+plugin.aimaccregwizz.USERNAME_AND_PASSWORD=Screen Name and Password
plugin.aimaccregwizz.REGISTER_NEW_ACCOUNT=Register new account
plugin.aimaccregwizz.REGISTER_NEW_ACCOUNT_TEXT=In case you don't have an AIM account, click on this button to create a new one.
plugin.aimaccregwizz.OVERRIDE_SERVER_DEFAULT_OPTIONS=Override server default options

Modified: trunk/src/net/java/sip/communicator/impl/gui/main/account/AccountRegSummaryPage.java
Url: https://sip-communicator.dev.java.net/source/browse/sip-communicator/trunk/src/net/java/sip/communicator/impl/gui/main/account/AccountRegSummaryPage.java?view=diff&rev=5179&p1=trunk/src/net/java/sip/communicator/impl/gui/main/account/AccountRegSummaryPage.java&p2=trunk/src/net/java/sip/communicator/impl/gui/main/account/AccountRegSummaryPage.java&r1=5178&r2=5179

--- trunk/src/net/java/sip/communicator/impl/gui/main/account/AccountRegSummaryPage.java (original)
+++ trunk/src/net/java/sip/communicator/impl/gui/main/account/AccountRegSummaryPage.java 2009-03-28 10:45:55+0000
@@ -72,11 +72,11 @@
*
* @param summaryData The data to insert in the summary page.
*/
- private void init(Iterator<Map.Entry> summaryData)
+ private void init(Iterator<Map.Entry<String, String>> summaryData)
{
while (summaryData.hasNext())
{
- Map.Entry entry = summaryData.next();
+ Map.Entry<String, String> entry = summaryData.next();

        JLabel keyLabel = new JLabel\(entry\.getKey\(\)\.toString\(\) \+ &quot;:&quot;\);
        JLabel valueLabel = new JLabel\(entry\.getValue\(\)\.toString\(\)\);

Added: trunk/src/net/java/sip/communicator/impl/gui/main/account/EmptyAccountRegistrationWizard.java
Url: https://sip-communicator.dev.java.net/source/browse/sip-communicator/trunk/src/net/java/sip/communicator/impl/gui/main/account/EmptyAccountRegistrationWizard.java?view=auto&rev=5179

--- (empty file)
+++ trunk/src/net/java/sip/communicator/impl/gui/main/account/EmptyAccountRegistrationWizard.java 2009-03-28 10:45:55+0000
@@ -0,0 +1,236 @@
+/*
+ * SIP Communicator, the OpenSource Java VoIP and Instant Messaging client.
+ *
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ */
+package net.java.sip.communicator.impl.gui.main.account;
+
+import java.awt.*;
+import java.util.*;
+import java.util.Map.*;
+
+import net.java.sip.communicator.impl.gui.*;
+import net.java.sip.communicator.service.gui.*;
+import net.java.sip.communicator.service.protocol.*;
+
+/**
+ * We use this class as a dummy implementation of the
+ * <tt>AccountRegistrationWizard</tt> only containing a blank page and not
+ * related to a specific protocol. We are using this class so that we could
+ * have the NewAccountDialog open without having a specific protocol selected.
+ *
+ * The point of having this empty page is to avoid users mistakenly filling in
+ * data for the default protocol without noticing that it is not really the
+ * protocol they had in mind.
+ *
+ * @author Emil Ivov
+ */
+class EmptyAccountRegistrationWizard
+ implements AccountRegistrationWizard
+{
+ /**
+ * The only page we need in this wizard, containing a prompt for the user
+ * to select a wizrd.
+ */
+ private EmptyAccountRegistrationWizardPage page
+ = new EmptyAccountRegistrationWizardPage(this);
+
+ /**
+ * A list containing the only page that this dummy wizard has.
+ */
+ private LinkedList<WizardPage> pages = new LinkedList<WizardPage>();
+
+
+ /**
+ * Creates the wizard.
+ */
+ public EmptyAccountRegistrationWizard()
+ {
+ pages.add(page);
+ }
+
+ /**
+ * Returns the ID of our only page.
+ *
+ * @return the ID of our only page
+ */
+ public Object getFirstPageIdentifier()
+ {
+ return page.getIdentifier();
+ }
+
+ /**
+ * Called by the NewAccountDialog protocol combo renderer. We don't have an
+ * icon so we return <tt>null</tt>
+ *
+ * @return <tt>null</tt>;
+ */
+ public byte[] getIcon()
+ {
+ return null;
+ }
+
+ /**
+ * Returns the ID of our last and only page.
+ *
+ * @return the id of our last (and only) page.
+ */
+ public Object getLastPageIdentifier()
+ {
+ return EmptyAccountRegistrationWizardPage.FIRST_PAGE_IDENTIFIER;
+ }
+
+ /**
+ * Returns null since we don't have any images associated with this wizard
+ * or no image in our case.
+ *
+ * return an empty byte[] array.
+ */
+ public byte[] getPageImage()
+ {
+ return null;
+ }
+
+ /**
+ * Returns an iterator over a list containing our only page.
+ *
+ * @return an iterator over a list containing our only page.
+ */
+ public Iterator<WizardPage> getPages()
+ {
+ return pages.iterator();
+ }
+
+ /**
+ * Returns a dummy protocol description.
+ *
+ * @return a string containing a dummy protocol description.
+ */
+ public String getProtocolDescription()
+ {
+ return GuiActivator.getResources()
+ .getI18NString("impl.gui.main.account.DUMMY_PROTOCOL_DESCRIPTION");
+ }
+
+ /**
+ * Returns the name of a dummy protocol which is actually a prompt to select
+ * a network.
+ *
+ * @return a string prompting the user to select a network.
+ */
+ public String getProtocolName()
+ {
+ return GuiActivator.getResources()
+ .getI18NString("impl.gui.main.account.DUMMY_PROTOCOL_NAME");
+ }
+
+ /**
+ * Returns our only wizard page.
+ *
+ * @return our only wizard page.
+ */
+ public Object getSimpleForm()
+ {
+ return page;
+ }
+
+ /**
+ * Returns a dummy size that we never use here.
+ */
+ public Dimension getSize()
+ {
+ return new Dimension(600, 500);
+ }
+
+ /**
+ * Returns a dummy <tt>Iterator</tt>. Never really called.
+ *
+ * @return an Empty iterator.
+ */
+ public Iterator<Entry<String, String>> getSummary()
+ {
+ return new java.util.LinkedList<Entry<String, String>>().iterator();
+ }
+
+ /**
+ * Returns an empty string since never used.
+ *
+ * @return an empty string as we never use this method.
+ */
+ public String getUserNameExample()
+ {
+ return "";
+ }
+
+ /**
+ * Empty interface method implementation, unused in the case of the
+ * {@link EmptyAccountRegistrationWizard}
+ */
+ public boolean isModification()
+ {
+ return false;
+ }
+
+ /**
+ * Empty interface method implementation, unused in the case of the
+ * {@link EmptyAccountRegistrationWizard}
+ */
+ public boolean isSimpleFormEnabled()
+ {
+ return true;
+ }
+
+ /**
+ * Empty interface method implementation, unused in the case of the
+ * {@link EmptyAccountRegistrationWizard}
+ */
+ public boolean isWebSignupSupported()
+ {
+ return false;
+ }
+
+ /**
+ * Empty interface method implementation, unused in the case of the
+ * {@link EmptyAccountRegistrationWizard}
+ */
+ public void loadAccount(ProtocolProviderService protocolProvider)
+ {
+
+ }
+
+ /**
+ * Empty interface method implementation, unused in the case of the
+ * {@link EmptyAccountRegistrationWizard}
+ */
+ public void setModification(boolean isModification)
+ {
+ }
+
+ /**
+ * Empty interface method implementation, unused in the case of the
+ * {@link EmptyAccountRegistrationWizard}
+ */
+ public ProtocolProviderService signin() throws OperationFailedException
+ {
+ return null;
+ }
+
+ /**
+ * Empty interface method implementation, unused in the case of the
+ * {@link EmptyAccountRegistrationWizard}
+ */
+ public ProtocolProviderService signin(String userName, String password)
+ throws OperationFailedException
+ {
+ return null;
+ }
+
+ /**
+ * Empty interface method implementation, unused in the case of the
+ * {@link EmptyAccountRegistrationWizard}
+ */
+ public void webSignup() throws UnsupportedOperationException
+ {
+ }
+}

Added: trunk/src/net/java/sip/communicator/impl/gui/main/account/EmptyAccountRegistrationWizardPage.java
Url: https://sip-communicator.dev.java.net/source/browse/sip-communicator/trunk/src/net/java/sip/communicator/impl/gui/main/account/EmptyAccountRegistrationWizardPage.java?view=auto&rev=5179

--- (empty file)
+++ trunk/src/net/java/sip/communicator/impl/gui/main/account/EmptyAccountRegistrationWizardPage.java 2009-03-28 10:45:55+0000
@@ -0,0 +1,179 @@
+/*
+ * SIP Communicator, the OpenSource Java VoIP and Instant Messaging client.
+ *
+ * Distributable under LGPL license. See terms of license at gnu.org.
+ */
+package net.java.sip.communicator.impl.gui.main.account;
+
+import java.awt.*;
+
+import javax.swing.*;
+import javax.swing.event.*;
+
+import net.java.sip.communicator.impl.gui.*;
+import net.java.sip.communicator.service.gui.*;
+import net.java.sip.communicator.util.swing.*;
+
+/**
+ * The <tt>EmptyAccountRegistrationWizardPage</tt> is the page that users
+ * would seen in the NewAccountDialog as a default choice which would make them
+ * pick a new option.
+ *
+ * @author Emil Ivov
+ */
+public class EmptyAccountRegistrationWizardPage
+ implements WizardPage
+{
+ public static final String FIRST_PAGE_IDENTIFIER = "FirstPageIdentifier";
+
+ private JPanel mainPanel = new TransparentPanel(new BorderLayout());
+
+ /**
+ * Creates an instance of <tt>FirstWizardPage</tt>.
+ *
+ * @param wizard the parent wizard
+ */
+ public EmptyAccountRegistrationWizardPage(
+ EmptyAccountRegistrationWizard wizard)
+ {
+
+ mainPanel.setLayout(new BoxLayout(mainPanel, BoxLayout.Y_AXIS));
+ this.initComponents();
+ }
+
+ /**
+ * Initialize the UI for the first account
+ */
+ private void initComponents()
+ {
+ // Init strategies list
+ this.mainPanel = new TransparentPanel(new BorderLayout());
+
+ JPanel infoTitlePanel
+ = new TransparentPanel(new FlowLayout(FlowLayout.CENTER));
+ JTextArea firstDescription
+ = new JTextArea(GuiActivator.getResources().getI18NString(
+ "impl.gui.main.account.DEFAULT_PAGE_BODY"));
+ JLabel title
+ = new JLabel(GuiActivator.getResources().getI18NString(
+ "impl.gui.main.account.DEFAULT_PAGE_TITLE"));
+
+ // Title
+ title.setFont(title.getFont().deriveFont(Font.BOLD, 14.0f));
+ infoTitlePanel.add(title);
+ this.mainPanel.add(infoTitlePanel, BorderLayout.NORTH);
+
+ // Description
+ firstDescription.setLineWrap(true);
+ firstDescription.setEditable(false);
+ firstDescription.setOpaque(false);
+ firstDescription.setRows(6);
+ firstDescription.setWrapStyleWord(true);
+ firstDescription.setAutoscrolls(false);
+ this.mainPanel.add(firstDescription);
+ }
+
+ /**
+ * Returns the <tt>JPanel</tt> that contains the message prompting the user
+ * to select a protocol.
+ *
+ * @return the <tt>JPanel</tt> that contains the message prompting the user
+ * to select a protocol.
+ */
+ public Object getSimpleForm()
+ {
+ return mainPanel;
+ }
+
+ /**
+ * Implements the <code>WizardPage.getIdentifier</code> to return this
+ * page identifier.
+ *
+ * @return Returns the identifier of the current (the first) page of the
+ * wizard.
+ */
+ public Object getIdentifier()
+ {
+ return FIRST_PAGE_IDENTIFIER;
+ }
+
+ /**
+ * Implements <tt> WizardPage.getNextPageIdentifier</tt> to return
+ * the next page identifier - the summary page.
+ *
+ * @return Returns the identifier of the next page of the wizard.
+ */
+ public Object getNextPageIdentifier()
+ {
+ return WizardPage.SUMMARY_PAGE_IDENTIFIER;
+ }
+
+ /**
+ * Implements the <code>WizardPage.getBackPageIdentifier</code> to return
+ * the next back identifier - the default page.
+ *
+ * @return Returns the identifier of the previous page of the wizard.
+ */
+ public Object getBackPageIdentifier()
+ {
+ return WizardPage.DEFAULT_PAGE_IDENTIFIER;
+ }
+
+ /**
+ * Implements the <code>WizardPage.getWizardForm</code> to return this
+ * panel.
+ * @return Returns this form of the wizard.
+ */
+ public Object getWizardForm()
+ {
+ return this;
+ }
+
+ /**
+ * Empty interface method implementation, unused in the case of the
+ * {@link EmptyAccountRegistrationWizardPage}
+ */
+ public void pageShowing()
+ {
+ }
+
+ /**
+ * Empty interface method implementation, unused in the case of the
+ * {@link EmptyAccountRegistrationWizardPage}
+ */
+ public void commitPage()
+ {
+ }
+
+ /**
+ * Empty interface method implementation, unused in the case of the
+ * {@link EmptyAccountRegistrationWizardPage}
+ */
+ public void changedUpdate(DocumentEvent e)
+ {
+ }
+
+ /**
+ * Empty interface method implementation, unused in the case of the
+ * {@link EmptyAccountRegistrationWizardPage}
+ */
+ public void pageHiding()
+ {
+ }
+
+ /**
+ * Empty interface method implementation, unused in the case of the
+ * {@link EmptyAccountRegistrationWizardPage}
+ */
+ public void pageShown()
+ {
+ }
+
+ /**
+ * Empty interface method implementation, unused in the case of the
+ * {@link EmptyAccountRegistrationWizardPage}
+ */
+ public void pageBack()
+ {
+ }
+}

Modified: trunk/src/net/java/sip/communicator/impl/gui/main/account/NewAccountDialog.java
Url: https://sip-communicator.dev.java.net/source/browse/sip-communicator/trunk/src/net/java/sip/communicator/impl/gui/main/account/NewAccountDialog.java?view=diff&rev=5179&p1=trunk/src/net/java/sip/communicator/impl/gui/main/account/NewAccountDialog.java&p2=trunk/src/net/java/sip/communicator/impl/gui/main/account/NewAccountDialog.java&r1=5178&r2=5179

--- trunk/src/net/java/sip/communicator/impl/gui/main/account/NewAccountDialog.java (original)
+++ trunk/src/net/java/sip/communicator/impl/gui/main/account/NewAccountDialog.java 2009-03-28 10:45:55+0000
@@ -56,6 +56,9 @@
private TransparentPanel buttonPanel
= new TransparentPanel(new BorderLayout());

+ private EmptyAccountRegistrationWizard emptyWizard
+ = new EmptyAccountRegistrationWizard();
+
private String preferredWizardName;

private static NewAccountDialog newAccountDialog;

@@ -196,7 +199,8 @@
}
else//if we don't we send our empty page and let the wizard choose.
{
-
+ networkComboBox.insertItemAt(emptyWizard, 0);
+ networkComboBox.setSelectedItem(emptyWizard);
}
}
}
@@ -232,8 +236,18 @@
}

        this\.setText\(wizard\.getProtocolName\(\)\);

- this.setIcon(new ImageIcon(
- ImageLoader.getBytesInImage(wizard.getIcon())));
+ byte[] icon = wizard.getIcon();
+
+ if( icon != null && icon.length > 0)
+ {
+ this.setIcon(new ImageIcon(
+ ImageLoader.getBytesInImage(icon)));
+ }
+ else
+ {
+ this.setIcon(null);
+ }
+

        return this;
    \}

@@ -319,6 +333,12 @@
ProtocolProviderService protocolProvider;
try
{
+ if(wizard == emptyWizard)
+ {
+ loadErrorMessage(GuiActivator.getResources().getI18NString(
+ "service.gui.CHOOSE_NETWORK"));
+
+ }
protocolProvider = wizard.signin();

            if \(protocolProvider \!= null\)

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@sip-communicator.dev.java.net
For additional commands, e-mail: commits-help@sip-communicator.dev.java.net

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@sip-communicator.dev.java.net
For additional commands, e-mail: dev-help@sip-communicator.dev.java.net


#2

Hey Lubo,

Lubomir Marinov wrote:

Clicking the advanced button of the simple account registration dialog
while the value of the Network combo is "select network" now throws a
NullPointerException.

Darn. I had something in place in case the user would go for Add but
completely forgot about Advanced. Thanks for reminding me!

Steps to reproduce:
1. Invoke File > Add new account from the main menu of the application.
2. The value of the Network combo should be "select network" at this
point so click the Advanced button at the bottom left of the dialog.

What happens:
- A NullPointerException stack trace is printed in Command Prompt.
- The fact is that the Advanced and Add buttons are always enabled.

What is expected to happen:
- The Advanced button should be disabled until I select an actual
network because the advanced account registration wizard doesn't allow
me to select the network.
- The Add button should be disabled until I select an actual work (and
provide some input in the network-specific fields for that matter but
I guess it may be too hard to implement).

Sounds reasonable. I've just implemented and committed. Could you please
give it a try and let me know if it doesn't work as expected?

Cheers
Emil

···

On Sat, Mar 28, 2009 at 1:45 PM, <emcho@dev.java.net> wrote:

Author: emcho
Date: 2009-03-28 10:45:55+0000
New Revision: 5179

Added:
  trunk/src/net/java/sip/communicator/impl/gui/main/account/EmptyAccountRegistrationWizard.java
  trunk/src/net/java/sip/communicator/impl/gui/main/account/EmptyAccountRegistrationWizardPage.java
Modified:
  trunk/resources/languages/resources.properties
  trunk/src/net/java/sip/communicator/impl/gui/main/account/AccountRegSummaryPage.java
  trunk/src/net/java/sip/communicator/impl/gui/main/account/NewAccountDialog.java

Log:
Fixes issue #538 : Add Account wizard's protocol combo should be empty by default. The "Add Account" wizard will now open without a selected default protocol and instead it would open a page prompting the user to select a network.

Modified: trunk/resources/languages/resources.properties
Url: https://sip-communicator.dev.java.net/source/browse/sip-communicator/trunk/resources/languages/resources.properties?view=diff&rev=5179&p1=trunk/resources/languages/resources.properties&p2=trunk/resources/languages/resources.properties&r1=5178&r2=5179

--- trunk/resources/languages/resources.properties (original)
+++ trunk/resources/languages/resources.properties 2009-03-28 10:45:55+0000
@@ -350,6 +350,12 @@
impl.swingnotification.POPUP_MESSAGE_HANDLER=SIP Communicator popups
impl.growlnotification.POPUP_MESSAGE_HANDLER=Growl notifications

+# New Account Dialog
+impl.gui.main.account.DEFAULT_PAGE_TITLE=Select Network
+impl.gui.main.account.DEFAULT_PAGE_BODY=You can use the list above to select the network that you would like to add an account for.
+impl.gui.main.account.DUMMY_PROTOCOL_NAME=select network
+impl.gui.main.account.DUMMY_PROTOCOL_DESCRIPTION=select network
+
# account info
plugin.accountinfo.TITLE=Account Info
plugin.accountinfo.BROWSE=Browse
@@ -378,7 +384,7 @@
plugin.aimaccregwizz.PROTOCOL_NAME=AIM
plugin.aimaccregwizz.PROTOCOL_DESCRIPTION=The AIM service protocol
plugin.aimaccregwizz.USERNAME=AIM Screenname:
-plugin.aimaccregwizz.USERNAME_AND_PASSWORD=UIN and Password
+plugin.aimaccregwizz.USERNAME_AND_PASSWORD=Screen Name and Password
plugin.aimaccregwizz.REGISTER_NEW_ACCOUNT=Register new account
plugin.aimaccregwizz.REGISTER_NEW_ACCOUNT_TEXT=In case you don't have an AIM account, click on this button to create a new one.
plugin.aimaccregwizz.OVERRIDE_SERVER_DEFAULT_OPTIONS=Override server default options

Modified: trunk/src/net/java/sip/communicator/impl/gui/main/account/AccountRegSummaryPage.java
Url: https://sip-communicator.dev.java.net/source/browse/sip-communicator/trunk/src/net/java/sip/communicator/impl/gui/main/account/AccountRegSummaryPage.java?view=diff&rev=5179&p1=trunk/src/net/java/sip/communicator/impl/gui/main/account/AccountRegSummaryPage.java&p2=trunk/src/net/java/sip/communicator/impl/gui/main/account/AccountRegSummaryPage.java&r1=5178&r2=5179

--- trunk/src/net/java/sip/communicator/impl/gui/main/account/AccountRegSummaryPage.java (original)
+++ trunk/src/net/java/sip/communicator/impl/gui/main/account/AccountRegSummaryPage.java 2009-03-28 10:45:55+0000
@@ -72,11 +72,11 @@
     *
     * @param summaryData The data to insert in the summary page.
     */
- private void init(Iterator<Map.Entry> summaryData)
+ private void init(Iterator<Map.Entry<String, String>> summaryData)
    {
        while (summaryData.hasNext())
        {
- Map.Entry entry = summaryData.next();
+ Map.Entry<String, String> entry = summaryData.next();

            JLabel keyLabel = new JLabel(entry.getKey().toString() + ":");
            JLabel valueLabel = new JLabel(entry.getValue().toString());

Added: trunk/src/net/java/sip/communicator/impl/gui/main/account/EmptyAccountRegistrationWizard.java
Url: https://sip-communicator.dev.java.net/source/browse/sip-communicator/trunk/src/net/java/sip/communicator/impl/gui/main/account/EmptyAccountRegistrationWizard.java?view=auto&rev=5179

--- (empty file)
+++ trunk/src/net/java/sip/communicator/impl/gui/main/account/EmptyAccountRegistrationWizard.java 2009-03-28 10:45:55+0000
@@ -0,0 +1,236 @@
+/*
+ * SIP Communicator, the OpenSource Java VoIP and Instant Messaging client.
+ *
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ */
+package net.java.sip.communicator.impl.gui.main.account;
+
+import java.awt.*;
+import java.util.*;
+import java.util.Map.*;
+
+import net.java.sip.communicator.impl.gui.*;
+import net.java.sip.communicator.service.gui.*;
+import net.java.sip.communicator.service.protocol.*;
+
+/**
+ * We use this class as a dummy implementation of the
+ * <tt>AccountRegistrationWizard</tt> only containing a blank page and not
+ * related to a specific protocol. We are using this class so that we could
+ * have the NewAccountDialog open without having a specific protocol selected.
+ *
+ * The point of having this empty page is to avoid users mistakenly filling in
+ * data for the default protocol without noticing that it is not really the
+ * protocol they had in mind.
+ *
+ * @author Emil Ivov
+ */
+class EmptyAccountRegistrationWizard
+ implements AccountRegistrationWizard
+{
+ /**
+ * The only page we need in this wizard, containing a prompt for the user
+ * to select a wizrd.
+ */
+ private EmptyAccountRegistrationWizardPage page
+ = new EmptyAccountRegistrationWizardPage(this);
+
+ /**
+ * A list containing the only page that this dummy wizard has.
+ */
+ private LinkedList<WizardPage> pages = new LinkedList<WizardPage>();
+
+
+ /**
+ * Creates the wizard.
+ */
+ public EmptyAccountRegistrationWizard()
+ {
+ pages.add(page);
+ }
+
+ /**
+ * Returns the ID of our only page.
+ *
+ * @return the ID of our only page
+ */
+ public Object getFirstPageIdentifier()
+ {
+ return page.getIdentifier();
+ }
+
+ /**
+ * Called by the NewAccountDialog protocol combo renderer. We don't have an
+ * icon so we return <tt>null</tt>
+ *
+ * @return <tt>null</tt>;
+ */
+ public byte[] getIcon()
+ {
+ return null;
+ }
+
+ /**
+ * Returns the ID of our last and only page.
+ *
+ * @return the id of our last (and only) page.
+ */
+ public Object getLastPageIdentifier()
+ {
+ return EmptyAccountRegistrationWizardPage.FIRST_PAGE_IDENTIFIER;
+ }
+
+ /**
+ * Returns null since we don't have any images associated with this wizard
+ * or no image in our case.
+ *
+ * return an empty byte[] array.
+ */
+ public byte[] getPageImage()
+ {
+ return null;
+ }
+
+ /**
+ * Returns an iterator over a list containing our only page.
+ *
+ * @return an iterator over a list containing our only page.
+ */
+ public Iterator<WizardPage> getPages()
+ {
+ return pages.iterator();
+ }
+
+ /**
+ * Returns a dummy protocol description.
+ *
+ * @return a string containing a dummy protocol description.
+ */
+ public String getProtocolDescription()
+ {
+ return GuiActivator.getResources()
+ .getI18NString("impl.gui.main.account.DUMMY_PROTOCOL_DESCRIPTION");
+ }
+
+ /**
+ * Returns the name of a dummy protocol which is actually a prompt to select
+ * a network.
+ *
+ * @return a string prompting the user to select a network.
+ */
+ public String getProtocolName()
+ {
+ return GuiActivator.getResources()
+ .getI18NString("impl.gui.main.account.DUMMY_PROTOCOL_NAME");
+ }
+
+ /**
+ * Returns our only wizard page.
+ *
+ * @return our only wizard page.
+ */
+ public Object getSimpleForm()
+ {
+ return page;
+ }
+
+ /**
+ * Returns a dummy size that we never use here.
+ */
+ public Dimension getSize()
+ {
+ return new Dimension(600, 500);
+ }
+
+ /**
+ * Returns a dummy <tt>Iterator</tt>. Never really called.
+ *
+ * @return an Empty iterator.
+ */
+ public Iterator<Entry<String, String>> getSummary()
+ {
+ return new java.util.LinkedList<Entry<String, String>>().iterator();
+ }
+
+ /**
+ * Returns an empty string since never used.
+ *
+ * @return an empty string as we never use this method.
+ */
+ public String getUserNameExample()
+ {
+ return "";
+ }
+
+ /**
+ * Empty interface method implementation, unused in the case of the
+ * {@link EmptyAccountRegistrationWizard}
+ */
+ public boolean isModification()
+ {
+ return false;
+ }
+
+ /**
+ * Empty interface method implementation, unused in the case of the
+ * {@link EmptyAccountRegistrationWizard}
+ */
+ public boolean isSimpleFormEnabled()
+ {
+ return true;
+ }
+
+ /**
+ * Empty interface method implementation, unused in the case of the
+ * {@link EmptyAccountRegistrationWizard}
+ */
+ public boolean isWebSignupSupported()
+ {
+ return false;
+ }
+
+ /**
+ * Empty interface method implementation, unused in the case of the
+ * {@link EmptyAccountRegistrationWizard}
+ */
+ public void loadAccount(ProtocolProviderService protocolProvider)
+ {
+
+ }
+
+ /**
+ * Empty interface method implementation, unused in the case of the
+ * {@link EmptyAccountRegistrationWizard}
+ */
+ public void setModification(boolean isModification)
+ {
+ }
+
+ /**
+ * Empty interface method implementation, unused in the case of the
+ * {@link EmptyAccountRegistrationWizard}
+ */
+ public ProtocolProviderService signin() throws OperationFailedException
+ {
+ return null;
+ }
+
+ /**
+ * Empty interface method implementation, unused in the case of the
+ * {@link EmptyAccountRegistrationWizard}
+ */
+ public ProtocolProviderService signin(String userName, String password)
+ throws OperationFailedException
+ {
+ return null;
+ }
+
+ /**
+ * Empty interface method implementation, unused in the case of the
+ * {@link EmptyAccountRegistrationWizard}
+ */
+ public void webSignup() throws UnsupportedOperationException
+ {
+ }
+}

Added: trunk/src/net/java/sip/communicator/impl/gui/main/account/EmptyAccountRegistrationWizardPage.java
Url: https://sip-communicator.dev.java.net/source/browse/sip-communicator/trunk/src/net/java/sip/communicator/impl/gui/main/account/EmptyAccountRegistrationWizardPage.java?view=auto&rev=5179

--- (empty file)
+++ trunk/src/net/java/sip/communicator/impl/gui/main/account/EmptyAccountRegistrationWizardPage.java 2009-03-28 10:45:55+0000
@@ -0,0 +1,179 @@
+/*
+ * SIP Communicator, the OpenSource Java VoIP and Instant Messaging client.
+ *
+ * Distributable under LGPL license. See terms of license at gnu.org.
+ */
+package net.java.sip.communicator.impl.gui.main.account;
+
+import java.awt.*;
+
+import javax.swing.*;
+import javax.swing.event.*;
+
+import net.java.sip.communicator.impl.gui.*;
+import net.java.sip.communicator.service.gui.*;
+import net.java.sip.communicator.util.swing.*;
+
+/**
+ * The <tt>EmptyAccountRegistrationWizardPage</tt> is the page that users
+ * would seen in the NewAccountDialog as a default choice which would make them
+ * pick a new option.
+ *
+ * @author Emil Ivov
+ */
+public class EmptyAccountRegistrationWizardPage
+ implements WizardPage
+{
+ public static final String FIRST_PAGE_IDENTIFIER = "FirstPageIdentifier";
+
+ private JPanel mainPanel = new TransparentPanel(new BorderLayout());
+
+ /**
+ * Creates an instance of <tt>FirstWizardPage</tt>.
+ *
+ * @param wizard the parent wizard
+ */
+ public EmptyAccountRegistrationWizardPage(
+ EmptyAccountRegistrationWizard wizard)
+ {
+
+ mainPanel.setLayout(new BoxLayout(mainPanel, BoxLayout.Y_AXIS));
+ this.initComponents();
+ }
+
+ /**
+ * Initialize the UI for the first account
+ */
+ private void initComponents()
+ {
+ // Init strategies list
+ this.mainPanel = new TransparentPanel(new BorderLayout());
+
+ JPanel infoTitlePanel
+ = new TransparentPanel(new FlowLayout(FlowLayout.CENTER));
+ JTextArea firstDescription
+ = new JTextArea(GuiActivator.getResources().getI18NString(
+ "impl.gui.main.account.DEFAULT_PAGE_BODY"));
+ JLabel title
+ = new JLabel(GuiActivator.getResources().getI18NString(
+ "impl.gui.main.account.DEFAULT_PAGE_TITLE"));
+
+ // Title
+ title.setFont(title.getFont().deriveFont(Font.BOLD, 14.0f));
+ infoTitlePanel.add(title);
+ this.mainPanel.add(infoTitlePanel, BorderLayout.NORTH);
+
+ // Description
+ firstDescription.setLineWrap(true);
+ firstDescription.setEditable(false);
+ firstDescription.setOpaque(false);
+ firstDescription.setRows(6);
+ firstDescription.setWrapStyleWord(true);
+ firstDescription.setAutoscrolls(false);
+ this.mainPanel.add(firstDescription);
+ }
+
+ /**
+ * Returns the <tt>JPanel</tt> that contains the message prompting the user
+ * to select a protocol.
+ *
+ * @return the <tt>JPanel</tt> that contains the message prompting the user
+ * to select a protocol.
+ */
+ public Object getSimpleForm()
+ {
+ return mainPanel;
+ }
+
+ /**
+ * Implements the <code>WizardPage.getIdentifier</code> to return this
+ * page identifier.
+ *
+ * @return Returns the identifier of the current (the first) page of the
+ * wizard.
+ */
+ public Object getIdentifier()
+ {
+ return FIRST_PAGE_IDENTIFIER;
+ }
+
+ /**
+ * Implements <tt> WizardPage.getNextPageIdentifier</tt> to return
+ * the next page identifier - the summary page.
+ *
+ * @return Returns the identifier of the next page of the wizard.
+ */
+ public Object getNextPageIdentifier()
+ {
+ return WizardPage.SUMMARY_PAGE_IDENTIFIER;
+ }
+
+ /**
+ * Implements the <code>WizardPage.getBackPageIdentifier</code> to return
+ * the next back identifier - the default page.
+ *
+ * @return Returns the identifier of the previous page of the wizard.
+ */
+ public Object getBackPageIdentifier()
+ {
+ return WizardPage.DEFAULT_PAGE_IDENTIFIER;
+ }
+
+ /**
+ * Implements the <code>WizardPage.getWizardForm</code> to return this
+ * panel.
+ * @return Returns this form of the wizard.
+ */
+ public Object getWizardForm()
+ {
+ return this;
+ }
+
+ /**
+ * Empty interface method implementation, unused in the case of the
+ * {@link EmptyAccountRegistrationWizardPage}
+ */
+ public void pageShowing()
+ {
+ }
+
+ /**
+ * Empty interface method implementation, unused in the case of the
+ * {@link EmptyAccountRegistrationWizardPage}
+ */
+ public void commitPage()
+ {
+ }
+
+ /**
+ * Empty interface method implementation, unused in the case of the
+ * {@link EmptyAccountRegistrationWizardPage}
+ */
+ public void changedUpdate(DocumentEvent e)
+ {
+ }
+
+ /**
+ * Empty interface method implementation, unused in the case of the
+ * {@link EmptyAccountRegistrationWizardPage}
+ */
+ public void pageHiding()
+ {
+ }
+
+ /**
+ * Empty interface method implementation, unused in the case of the
+ * {@link EmptyAccountRegistrationWizardPage}
+ */
+ public void pageShown()
+ {
+ }
+
+ /**
+ * Empty interface method implementation, unused in the case of the
+ * {@link EmptyAccountRegistrationWizardPage}
+ */
+ public void pageBack()
+ {
+ }
+}

Modified: trunk/src/net/java/sip/communicator/impl/gui/main/account/NewAccountDialog.java
Url: https://sip-communicator.dev.java.net/source/browse/sip-communicator/trunk/src/net/java/sip/communicator/impl/gui/main/account/NewAccountDialog.java?view=diff&rev=5179&p1=trunk/src/net/java/sip/communicator/impl/gui/main/account/NewAccountDialog.java&p2=trunk/src/net/java/sip/communicator/impl/gui/main/account/NewAccountDialog.java&r1=5178&r2=5179

--- trunk/src/net/java/sip/communicator/impl/gui/main/account/NewAccountDialog.java (original)
+++ trunk/src/net/java/sip/communicator/impl/gui/main/account/NewAccountDialog.java 2009-03-28 10:45:55+0000
@@ -56,6 +56,9 @@
    private TransparentPanel buttonPanel
        = new TransparentPanel(new BorderLayout());

+ private EmptyAccountRegistrationWizard emptyWizard
+ = new EmptyAccountRegistrationWizard();
+
    private String preferredWizardName;

    private static NewAccountDialog newAccountDialog;
@@ -196,7 +199,8 @@
            }
            else//if we don't we send our empty page and let the wizard choose.
            {
-
+ networkComboBox.insertItemAt(emptyWizard, 0);
+ networkComboBox.setSelectedItem(emptyWizard);
            }
        }
    }
@@ -232,8 +236,18 @@
            }

            this.setText(wizard.getProtocolName());
- this.setIcon(new ImageIcon(
- ImageLoader.getBytesInImage(wizard.getIcon())));
+ byte[] icon = wizard.getIcon();
+
+ if( icon != null && icon.length > 0)
+ {
+ this.setIcon(new ImageIcon(
+ ImageLoader.getBytesInImage(icon)));
+ }
+ else
+ {
+ this.setIcon(null);
+ }
+

            return this;
        }
@@ -319,6 +333,12 @@
            ProtocolProviderService protocolProvider;
            try
            {
+ if(wizard == emptyWizard)
+ {
+ loadErrorMessage(GuiActivator.getResources().getI18NString(
+ "service.gui.CHOOSE_NETWORK"));
+
+ }
                protocolProvider = wizard.signin();

                if (protocolProvider != null)

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@sip-communicator.dev.java.net
For additional commands, e-mail: commits-help@sip-communicator.dev.java.net

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@sip-communicator.dev.java.net
For additional commands, e-mail: dev-help@sip-communicator.dev.java.net

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@sip-communicator.dev.java.net
For additional commands, e-mail: dev-help@sip-communicator.dev.java.net