aboutsummaryrefslogtreecommitdiffstats
path: root/src/net
diff options
context:
space:
mode:
authorLyubomir Marinov <lyubomir.marinov@jitsi.org>2009-03-24 14:25:56 +0000
committerLyubomir Marinov <lyubomir.marinov@jitsi.org>2009-03-24 14:25:56 +0000
commit74e985d894848de833fd4ac7d030e73acd63ee59 (patch)
treef3eb1db6b87a27141bf52a661cfe85704a7bb9b7 /src/net
parent9ae0d7a98b9aa543e01c000977409e9a957726bf (diff)
downloadjitsi-74e985d894848de833fd4ac7d030e73acd63ee59.zip
jitsi-74e985d894848de833fd4ac7d030e73acd63ee59.tar.gz
jitsi-74e985d894848de833fd4ac7d030e73acd63ee59.tar.bz2
Fixes issue #517 (Previous button on Advanced-mode AccountRegistrationWizard throws WizardPanelNotFoundException).
Diffstat (limited to 'src/net')
-rw-r--r--src/net/java/sip/communicator/impl/gui/customcontrols/wizard/Wizard.java45
-rw-r--r--src/net/java/sip/communicator/impl/gui/customcontrols/wizard/WizardController.java30
-rw-r--r--src/net/java/sip/communicator/impl/gui/main/account/AccountRegWizardContainerImpl.java73
-rw-r--r--src/net/java/sip/communicator/service/gui/WizardPage.java4
4 files changed, 45 insertions, 107 deletions
diff --git a/src/net/java/sip/communicator/impl/gui/customcontrols/wizard/Wizard.java b/src/net/java/sip/communicator/impl/gui/customcontrols/wizard/Wizard.java
index 08ba4f6..a47096d 100644
--- a/src/net/java/sip/communicator/impl/gui/customcontrols/wizard/Wizard.java
+++ b/src/net/java/sip/communicator/impl/gui/customcontrols/wizard/Wizard.java
@@ -96,7 +96,7 @@ public class Wizard
static Icon CANCEL_ICON;
- private final WizardModel wizardModel;
+ private final WizardModel wizardModel = new WizardModel();
private WizardController wizardController;
@@ -110,8 +110,8 @@ public class Wizard
private JButton cancelButton;
- private final java.util.List<WizardListener> wizardListeners =
- new Vector<WizardListener>();
+ private final java.util.List<WizardListener> wizardListeners
+ = new Vector<WizardListener>();
/**
* This method accepts a java.awt.Dialog object as the javax.swing.JDialog's
@@ -123,8 +123,6 @@ public class Wizard
{
super(owner, false);
- wizardModel = new WizardModel();
-
initComponents();
}
@@ -139,8 +137,6 @@ public class Wizard
{
super(owner, false);
- wizardModel = new WizardModel();
-
initComponents();
}
@@ -209,7 +205,7 @@ public class Wizard
* Removes from the wizard the <tt>WizardPage</tt> corresponding to the
* given identifier.
*
- * @param id The identifer of the wizard page.
+ * @param id The identifier of the wizard page.
*/
public void unregisterWizardPage(Object id)
{
@@ -277,53 +273,45 @@ public class Wizard
*/
public void propertyChange(PropertyChangeEvent evt)
{
+ String name = evt.getPropertyName();
- if (evt.getPropertyName().equals(WizardModel.CURRENT_PAGE_PROPERTY))
+ if (WizardModel.CURRENT_PAGE_PROPERTY.equals(name))
{
wizardController.resetButtonsToPanelRules();
}
- else if (evt.getPropertyName().equals(
- WizardModel.NEXT_FINISH_BUTTON_TEXT_PROPERTY))
+ else if (WizardModel.NEXT_FINISH_BUTTON_TEXT_PROPERTY.equals(name))
{
nextButton.setText(evt.getNewValue().toString());
}
- else if (evt.getPropertyName().equals(
- WizardModel.BACK_BUTTON_TEXT_PROPERTY))
+ else if (WizardModel.BACK_BUTTON_TEXT_PROPERTY.equals(name))
{
backButton.setText(evt.getNewValue().toString());
}
- else if (evt.getPropertyName().equals(
- WizardModel.CANCEL_BUTTON_TEXT_PROPERTY))
+ else if (WizardModel.CANCEL_BUTTON_TEXT_PROPERTY.equals(name))
{
cancelButton.setText(evt.getNewValue().toString());
}
- else if (evt.getPropertyName().equals(
- WizardModel.NEXT_FINISH_BUTTON_ENABLED_PROPERTY))
+ else if (WizardModel.NEXT_FINISH_BUTTON_ENABLED_PROPERTY.equals(name))
{
nextButton.setEnabled((Boolean) evt.getNewValue());
}
- else if (evt.getPropertyName().equals(
- WizardModel.BACK_BUTTON_ENABLED_PROPERTY))
+ else if (WizardModel.BACK_BUTTON_ENABLED_PROPERTY.equals(name))
{
backButton.setEnabled((Boolean) evt.getNewValue());
}
- else if (evt.getPropertyName().equals(
- WizardModel.CANCEL_BUTTON_ENABLED_PROPERTY))
+ else if (WizardModel.CANCEL_BUTTON_ENABLED_PROPERTY.equals(name))
{
cancelButton.setEnabled((Boolean) evt.getNewValue());
}
- else if (evt.getPropertyName().equals(
- WizardModel.NEXT_FINISH_BUTTON_ICON_PROPERTY))
+ else if (WizardModel.NEXT_FINISH_BUTTON_ICON_PROPERTY.equals(name))
{
nextButton.setIcon((Icon) evt.getNewValue());
}
- else if (evt.getPropertyName().equals(
- WizardModel.BACK_BUTTON_ICON_PROPERTY))
+ else if (WizardModel.BACK_BUTTON_ICON_PROPERTY.equals(name))
{
backButton.setIcon((Icon) evt.getNewValue());
}
- else if (evt.getPropertyName().equals(
- WizardModel.CANCEL_BUTTON_ICON_PROPERTY))
+ else if (WizardModel.CANCEL_BUTTON_ICON_PROPERTY.equals(name))
{
cancelButton.setIcon((Icon) evt.getNewValue());
}
@@ -418,10 +406,8 @@ public class Wizard
* a JDialog as a CardLayout panel surrounded by a small amount of space on
* each side, as well as three buttons at the bottom.
*/
-
private void initComponents()
{
-
wizardModel.addPropertyChangeListener(this);
wizardController = new WizardController(this);
@@ -502,6 +488,7 @@ public class Wizard
static {
ResourceManagementService resources = GuiActivator.getResources();
+
BACK_TEXT = resources.getI18NString("service.gui.PREVIOUS");
NEXT_TEXT = resources.getI18NString("service.gui.NEXT");
CANCEL_TEXT = resources.getI18NString("service.gui.CANCEL");
diff --git a/src/net/java/sip/communicator/impl/gui/customcontrols/wizard/WizardController.java b/src/net/java/sip/communicator/impl/gui/customcontrols/wizard/WizardController.java
index 9793a18..3889ff1 100644
--- a/src/net/java/sip/communicator/impl/gui/customcontrols/wizard/WizardController.java
+++ b/src/net/java/sip/communicator/impl/gui/customcontrols/wizard/WizardController.java
@@ -125,37 +125,27 @@ public class WizardController implements ActionListener {
* panel in question has one or more panels in front of it, enables the
* next button. Otherwise, disables it.
*/
- void resetButtonsToPanelRules() {
-
+ void resetButtonsToPanelRules()
+ {
WizardModel model = wizard.getModel();
WizardPage page = model.getCurrentWizardPage();
model.setCancelButtonText(Wizard.CANCEL_TEXT);
- model.setBackButtonText(Wizard.BACK_TEXT);
-
- if (page.getBackPageIdentifier() != null) {
- model.setBackButtonEnabled(Boolean.TRUE);
- }
- else {
- model.setBackButtonEnabled(Boolean.FALSE);
- }
-
- if (page.getNextPageIdentifier() != null) {
- model.setNextFinishButtonEnabled(Boolean.TRUE);
+ Object backPageIdentifier = page.getBackPageIdentifier();
+ model.setBackButtonEnabled(
+ (backPageIdentifier != null)
+ && !WizardPage.DEFAULT_PAGE_IDENTIFIER.equals(backPageIdentifier));
- }
- else {
- model.setNextFinishButtonEnabled(Boolean.FALSE);
- }
+ model.setBackButtonText(Wizard.BACK_TEXT);
- if (page.getNextPageIdentifier()
- .equals(WizardPage.FINISH_PAGE_IDENTIFIER)) {
+ model.setNextFinishButtonEnabled(page.getNextPageIdentifier() != null);
+ if (page.getNextPageIdentifier().equals(
+ WizardPage.FINISH_PAGE_IDENTIFIER)) {
model.setNextFinishButtonText(Wizard.FINISH_TEXT);
} else {
model.setNextFinishButtonText(Wizard.NEXT_TEXT);
}
-
}
}
diff --git a/src/net/java/sip/communicator/impl/gui/main/account/AccountRegWizardContainerImpl.java b/src/net/java/sip/communicator/impl/gui/main/account/AccountRegWizardContainerImpl.java
index 9f9db13..fc62dd2 100644
--- a/src/net/java/sip/communicator/impl/gui/main/account/AccountRegWizardContainerImpl.java
+++ b/src/net/java/sip/communicator/impl/gui/main/account/AccountRegWizardContainerImpl.java
@@ -5,7 +5,6 @@
*/
package net.java.sip.communicator.impl.gui.main.account;
-import java.awt.*;
import java.io.*;
import java.util.*;
import java.util.List;
@@ -39,7 +38,8 @@ public class AccountRegWizardContainerImpl
private AccountRegistrationWizard currentWizard;
- private final ConfigurationService configService = GuiActivator.getConfigurationService();
+ private final ConfigurationService configService
+ = GuiActivator.getConfigurationService();
private final Map<String, AccountRegistrationWizard> registeredWizards =
new Hashtable<String, AccountRegistrationWizard>();
@@ -78,16 +78,12 @@ public class AccountRegWizardContainerImpl
logger.debug("Found "
+ accountWizardRefs.length
+ " already installed providers.");
- for (int i = 0; i < accountWizardRefs.length; i++)
+ for (ServiceReference serRef : accountWizardRefs)
{
- ServiceReference serRef = accountWizardRefs[i];
-
- String protocolName = (String) serRef
- .getProperty(ProtocolProviderFactory.PROTOCOL);
-
- AccountRegistrationWizard wizard
- = (AccountRegistrationWizard) GuiActivator.bundleContext
- .getService(serRef);
+ String protocolName = (String)
+ serRef.getProperty(ProtocolProviderFactory.PROTOCOL);
+ AccountRegistrationWizard wizard = (AccountRegistrationWizard)
+ GuiActivator.bundleContext.getService(serRef);
this.addAccountRegistrationWizard(protocolName, wizard);
}
@@ -152,35 +148,7 @@ public class AccountRegWizardContainerImpl
wizard.setModification(true);
- Iterator<WizardPage> i = wizard.getPages();
-
- boolean firstPage = true;
-
- while (i.hasNext())
- {
- WizardPage page = i.next();
- Object identifier = page.getIdentifier();
-
- this.registerWizardPage(identifier, page);
-
- if (firstPage)
- {
- this.setCurrentPage(identifier);
- firstPage = false;
- }
- }
-
wizard.loadAccount(protocolProvider);
-
- try
- {
- this.setWizzardIcon(ImageIO.read(new ByteArrayInputStream(wizard
- .getPageImage())));
- }
- catch (IOException e1)
- {
- e1.printStackTrace();
- }
}
/**
@@ -204,10 +172,9 @@ public class AccountRegWizardContainerImpl
{
String accountUID = configService.getString(accountRootPropName);
- if (accountUID.equals(protocolProvider.getAccountID()
- .getAccountUniqueID()))
+ if (accountUID.equals(
+ protocolProvider.getAccountID().getAccountUniqueID()))
{
-
configService.setProperty(accountRootPropName + ".wizard",
wizard.getClass().getName().replace('.', '_'));
@@ -217,11 +184,8 @@ public class AccountRegWizardContainerImpl
if (!savedAccount)
{
- String accNodeName =
- "acc" + Long.toString(System.currentTimeMillis());
-
- String accountPackage =
- "net.java.sip.communicator.impl.gui.accounts." + accNodeName;
+ String accountPackage
+ = prefix + ".acc" + Long.toString(System.currentTimeMillis());
configService.setProperty(accountPackage, protocolProvider
.getAccountID().getAccountUniqueID());
@@ -250,9 +214,7 @@ public class AccountRegWizardContainerImpl
{
this.currentWizard = wizard;
- Dimension wizardSize = this.currentWizard.getSize();
-
- summaryPage.setPreferredSize(wizardSize);
+ summaryPage.setPreferredSize(this.currentWizard.getSize());
Iterator<WizardPage> i = wizard.getPages();
@@ -298,19 +260,14 @@ public class AccountRegWizardContainerImpl
return;
ServiceReference serRef = event.getServiceReference();
-
- String protocolName
- = (String) serRef.getProperty(ProtocolProviderFactory.PROTOCOL);
-
- Object sService = GuiActivator.bundleContext.getService(
- event.getServiceReference());
+ Object sService = GuiActivator.bundleContext.getService(serRef);
// we don't care if the source service is not a plugin component
if (! (sService instanceof AccountRegistrationWizard))
- {
return;
- }
+ String protocolName
+ = (String) serRef.getProperty(ProtocolProviderFactory.PROTOCOL);
AccountRegistrationWizard wizard
= (AccountRegistrationWizard) sService;
diff --git a/src/net/java/sip/communicator/service/gui/WizardPage.java b/src/net/java/sip/communicator/service/gui/WizardPage.java
index ac6ec3c..ab91a23 100644
--- a/src/net/java/sip/communicator/service/gui/WizardPage.java
+++ b/src/net/java/sip/communicator/service/gui/WizardPage.java
@@ -40,6 +40,10 @@ public interface WizardPage
/**
* The identifier of the default wizard page.
+ * <p>
+ * At the time of this writing, it seems from its current uses that the
+ * constant indicates a <tt>null</tt> back page.
+ * </p>
*/
String DEFAULT_PAGE_IDENTIFIER = "DEFAULT";