diff options
author | Yana Stamcheva <yana@jitsi.org> | 2008-06-23 10:13:09 +0000 |
---|---|---|
committer | Yana Stamcheva <yana@jitsi.org> | 2008-06-23 10:13:09 +0000 |
commit | b04e3f61cbae18446baa86cb291a5c66405a06d4 (patch) | |
tree | 009794ddbcb83b718894e10ff45da35e99555c26 | |
parent | ec05a7a407851d8994abbe087008041c7293452e (diff) | |
download | jitsi-b04e3f61cbae18446baa86cb291a5c66405a06d4.zip jitsi-b04e3f61cbae18446baa86cb291a5c66405a06d4.tar.gz jitsi-b04e3f61cbae18446baa86cb291a5c66405a06d4.tar.bz2 |
New Account configuration forms.
47 files changed, 1066 insertions, 668 deletions
diff --git a/src/net/java/sip/communicator/impl/gui/customcontrols/SIPCommDialog.java b/src/net/java/sip/communicator/impl/gui/customcontrols/SIPCommDialog.java index a33e682..07a5aab 100644 --- a/src/net/java/sip/communicator/impl/gui/customcontrols/SIPCommDialog.java +++ b/src/net/java/sip/communicator/impl/gui/customcontrols/SIPCommDialog.java @@ -30,7 +30,7 @@ public abstract class SIPCommDialog extends JDialog this.addWindowListener(new DialogWindowAdapter()); - this.initInputMap(); + this.initInputMap(); } public SIPCommDialog(Frame owner) 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 c19b47f..d4e652b 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 @@ -74,7 +74,7 @@ public class WizardController implements ActionListener { try { - page.pageNext(); + page.commitPage(); } catch (Exception ex) { diff --git a/src/net/java/sip/communicator/impl/gui/main/account/AccountRegFirstPage.java b/src/net/java/sip/communicator/impl/gui/main/account/AccountRegFirstPage.java index 198bd8b..12a96af 100644 --- a/src/net/java/sip/communicator/impl/gui/main/account/AccountRegFirstPage.java +++ b/src/net/java/sip/communicator/impl/gui/main/account/AccountRegFirstPage.java @@ -6,14 +6,12 @@ */ package net.java.sip.communicator.impl.gui.main.account; +import java.awt.*; +import java.awt.event.*; import java.io.*; import java.util.*; import javax.imageio.*; - -import java.awt.*; -import java.awt.event.*; - import javax.swing.*; import javax.swing.event.*; import javax.swing.table.*; @@ -22,7 +20,6 @@ import net.java.sip.communicator.impl.gui.customcontrols.*; import net.java.sip.communicator.impl.gui.i18n.*; import net.java.sip.communicator.impl.gui.utils.*; import net.java.sip.communicator.service.gui.*; -import net.java.sip.communicator.service.gui.event.*; import net.java.sip.communicator.util.*; /** @@ -33,8 +30,7 @@ import net.java.sip.communicator.util.*; * @author Yana Stamcheva */ public class AccountRegFirstPage extends JPanel - implements AccountRegistrationListener, - WizardPage, + implements WizardPage, ListSelectionListener, MouseListener { @@ -141,11 +137,9 @@ public class AccountRegFirstPage extends JPanel * <tt>AccountRegistrationWizardContainer</tt> adds a line for this * wizard in the table. */ - public void accountRegistrationAdded(AccountRegistrationEvent event) { - - final AccountRegistrationWizard wizard - = (AccountRegistrationWizard)event.getSource(); - + public void addAccountRegistrationWizard( + final AccountRegistrationWizard wizard) + { String pName = wizard.getProtocolName(); Image protocolImage = null; @@ -179,10 +173,8 @@ public class AccountRegFirstPage extends JPanel * <tt>AccountRegistrationWizardContainer</tt> removes the corresponding * line from the table. */ - public void accountRegistrationRemoved(AccountRegistrationEvent event) { - AccountRegistrationWizard wizard - = (AccountRegistrationWizard)event.getSource(); - + public void removeAccountRegistrationWizard(AccountRegistrationWizard wizard) + { tableModel.removeRow(tableModel.rowIndexOf(wizard)); } @@ -267,7 +259,7 @@ public class AccountRegFirstPage extends JPanel * the choosen wizard and register all the pages contained in this wizard * in our wizard container. */ - public void pageNext() + public void commitPage() { AccountRegistrationWizard wizard = (AccountRegistrationWizard)tableModel diff --git a/src/net/java/sip/communicator/impl/gui/main/account/AccountRegSummaryPage.java b/src/net/java/sip/communicator/impl/gui/main/account/AccountRegSummaryPage.java index d49bc1e..25770ff 100644 --- a/src/net/java/sip/communicator/impl/gui/main/account/AccountRegSummaryPage.java +++ b/src/net/java/sip/communicator/impl/gui/main/account/AccountRegSummaryPage.java @@ -145,7 +145,7 @@ public class AccountRegSummaryPage * from the wizard container when user clicks the "Next" button. We invoke * here the wizard finish method. */ - public void pageNext() + public void commitPage() { AccountRegistrationWizard wizard = this.wizardContainer.getCurrentWizard(); 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 3585a51..cc9fc1a 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 @@ -18,7 +18,6 @@ import net.java.sip.communicator.impl.gui.i18n.*; import net.java.sip.communicator.impl.gui.main.*; import net.java.sip.communicator.service.configuration.*; import net.java.sip.communicator.service.gui.*; -import net.java.sip.communicator.service.gui.event.*; import net.java.sip.communicator.service.protocol.*; import net.java.sip.communicator.util.*; @@ -47,12 +46,6 @@ public class AccountRegWizardContainerImpl private Hashtable registeredWizards = new Hashtable(); - /** - * Listeners interested in events dispatched upon modifications in the - * account registrations list. - */ - private Vector accountRegListeners = new Vector(); - public AccountRegWizardContainerImpl(MainFrame mainFrame) { super(mainFrame); @@ -68,8 +61,6 @@ public class AccountRegWizardContainerImpl this.registerWizardPage(summaryPage.getIdentifier(), summaryPage); - this.addAccountRegistrationListener(defaultPage); - ServiceReference[] accountWizardRefs = null; try { @@ -148,8 +139,7 @@ public class AccountRegWizardContainerImpl } } - this.fireAccountRegistrationEvent(wizard, - AccountRegistrationEvent.REGISTRATION_ADDED); + defaultPage.addAccountRegistrationWizard(wizard); } /** @@ -165,75 +155,7 @@ public class AccountRegWizardContainerImpl registeredWizards.remove(wizard.getClass().getName()); } - this.fireAccountRegistrationEvent(wizard, - AccountRegistrationEvent.REGISTRATION_REMOVED); - } - - /** - * Adds a listener for <tt>AccountRegistrationEvent</tt>s. - * - * @param l the listener to add - */ - public void addAccountRegistrationListener(AccountRegistrationListener l) - { - synchronized (accountRegListeners) - { - this.accountRegListeners.add(l); - } - } - - /** - * Removes a listener for <tt>AccountRegistrationEvent</tt>s. - * - * @param l the listener to remove - */ - public void removeAccountRegistrationListener(AccountRegistrationListener l) - { - synchronized (accountRegListeners) - { - this.accountRegListeners.remove(l); - } - } - - /** - * Creates the corresponding <tt>AccountRegistrationEvent</tt> instance - * and notifies all <tt>AccountRegistrationListener</tt>s that an account - * registration wizard has been added or removed from this container. - * - * @param wizard The wizard that has caused the event. - * @param eventID one of the REGISTRATION_XXX static fields indicating the - * nature of the event. - */ - private void fireAccountRegistrationEvent(AccountRegistrationWizard wizard, - int eventID) - { - AccountRegistrationEvent evt = - new AccountRegistrationEvent(wizard, eventID); - - logger.trace("Will dispatch the following mcl event: " + evt); - - synchronized (accountRegListeners) - { - Iterator listeners = this.accountRegListeners.iterator(); - - while (listeners.hasNext()) - { - AccountRegistrationListener l = - (AccountRegistrationListener) listeners.next(); - - switch (evt.getEventID()) - { - case AccountRegistrationEvent.REGISTRATION_ADDED: - l.accountRegistrationAdded(evt); - break; - case AccountRegistrationEvent.REGISTRATION_REMOVED: - l.accountRegistrationRemoved(evt); - break; - default: - logger.error("Unknown event type " + evt.getEventID()); - } - } - } + defaultPage.removeAccountRegistrationWizard(wizard); } /** diff --git a/src/net/java/sip/communicator/impl/gui/main/account/AccountsConfigurationForm.java b/src/net/java/sip/communicator/impl/gui/main/account/AccountsConfigurationForm.java new file mode 100644 index 0000000..478d248 --- /dev/null +++ b/src/net/java/sip/communicator/impl/gui/main/account/AccountsConfigurationForm.java @@ -0,0 +1,449 @@ +/* + * 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.awt.event.*; +import java.io.*; +import java.util.*; +import java.util.List; + +import javax.imageio.*; +import javax.swing.*; + +import net.java.sip.communicator.impl.gui.*; +import net.java.sip.communicator.impl.gui.i18n.*; +import net.java.sip.communicator.impl.gui.main.*; +import net.java.sip.communicator.impl.gui.utils.*; +import net.java.sip.communicator.service.configuration.*; +import net.java.sip.communicator.service.gui.*; +import net.java.sip.communicator.service.protocol.*; +import net.java.sip.communicator.util.*; + +import org.osgi.framework.*; + +/** + * The <tt>AccountsConfigurationForm</tt> is the form where the user could + * create, modify or delete an account. + * + * @author Yana Stamcheva + */ +public class AccountsConfigurationForm + extends JPanel + implements ConfigurationForm, + ActionListener, + ServiceListener +{ + private Logger logger = + Logger.getLogger(AccountsConfigurationForm.class.getName()); + + private JScrollPane scrollPane = new JScrollPane(); + + private JPanel wrapAccountsPanel = new JPanel(new BorderLayout()); + + private JPanel accountsPanel = new JPanel(); + + private JPanel buttonsPanel = new JPanel(new FlowLayout(FlowLayout.RIGHT)); + + private I18NString newString = Messages.getI18NString("newAccount"); + + private JButton newButton = new JButton(newString.getText()); + + private I18NString saveString = Messages.getI18NString("save"); + + private JButton saveButton = new JButton(saveString.getText()); + + private MainFrame mainFrame; + + private Hashtable accounts = new Hashtable(); + + /** + * Creates an instance of <tt>AccountsConfigurationForm</tt>. + * + * @param mainFrame the main application window + */ + public AccountsConfigurationForm(MainFrame mainFrame) + { + super(new BorderLayout()); + + this.mainFrame = mainFrame; + + GuiActivator.bundleContext.addServiceListener(this); + + this.add(scrollPane, BorderLayout.CENTER); + this.add(buttonsPanel, BorderLayout.SOUTH); + + this.newButton.addActionListener(this); + this.saveButton.addActionListener(this); + + this.newButton.setMnemonic(newString.getMnemonic()); + this.saveButton.setMnemonic(saveString.getMnemonic()); + + this.buttonsPanel.add(newButton); + this.buttonsPanel.add(saveButton); + + this.scrollPane.getViewport().add(wrapAccountsPanel); + + this.wrapAccountsPanel.add(accountsPanel, BorderLayout.NORTH); + + this.accountsInit(); + + this.setPreferredSize(new Dimension(500, 400)); + } + + /** + * Initializes the accounts table. + */ + private void accountsInit() + { + this.accountsPanel.setLayout(new BoxLayout(accountsPanel, + BoxLayout.Y_AXIS)); + + Set set = GuiActivator.getProtocolProviderFactories().entrySet(); + Iterator iter = set.iterator(); + + while (iter.hasNext()) + { + Map.Entry entry = (Map.Entry) iter.next(); + + ProtocolProviderFactory providerFactory = + (ProtocolProviderFactory) entry.getValue(); + + ArrayList accountsList = providerFactory.getRegisteredAccounts(); + + AccountID accountID; + ServiceReference serRef; + ProtocolProviderService protocolProvider; + + for (int i = 0; i < accountsList.size(); i++) + { + accountID = (AccountID) accountsList.get(i); + + boolean isHidden = + (accountID.getAccountProperties().get("HIDDEN_PROTOCOL") + != null); + + if (isHidden) + continue; + + serRef = providerFactory.getProviderForAccount(accountID); + + protocolProvider = + (ProtocolProviderService) GuiActivator.bundleContext + .getService(serRef); + + AccountPanel accountPanel = new AccountPanel(protocolProvider); + + accountsPanel.add(accountPanel); + accounts.put(protocolProvider, accountPanel); + } + } + } + + /** + * + */ + private class AccountPanel + extends JPanel + implements ActionListener + { + private JLabel protocolLabel = new JLabel(); + + private JLabel accountLabel = new JLabel(); + + private JPasswordField passwordField = new JPasswordField(); + + private I18NString modifyString = Messages.getI18NString("settings"); + + private I18NString removeString = Messages.getI18NString("remove"); + + private JButton modifyButton = new JButton(modifyString.getText()); + + private JButton removeButton = new JButton(removeString.getText()); + + private GridBagConstraints constraints = new GridBagConstraints(); + + private Image protocolImage; + + private ProtocolProviderService protocolProvider; + + public AccountPanel(ProtocolProviderService protocolProvider) + { + super(new GridBagLayout()); + + this.protocolProvider = protocolProvider; + + this.setPreferredSize(new Dimension(400, 80)); + this.setBorder(BorderFactory.createMatteBorder(0, 0, 1, 0, + Color.GRAY)); + + try + { + protocolImage = + ImageIO.read(new ByteArrayInputStream(protocolProvider + .getProtocolIcon() + .getIcon(ProtocolIcon.ICON_SIZE_16x16))); + } + catch (IOException e) + { + logger.error("Could not read image.", e); + } + protocolLabel.setIcon(new ImageIcon(protocolImage)); + constraints.insets = new Insets(0, 5, 0, 5); + constraints.weightx = 0; + constraints.gridx = 0; + constraints.gridy = 0; + constraints.anchor = GridBagConstraints.FIRST_LINE_START; + this.add(protocolLabel, constraints); + + this.accountLabel.setText(protocolProvider.getAccountID() + .getUserID()); + constraints.insets = new Insets(0, 0, 0, 0); + constraints.gridx = 1; + constraints.gridy = 0; + constraints.fill = GridBagConstraints.HORIZONTAL; + constraints.anchor = GridBagConstraints.FIRST_LINE_START; + constraints.weightx = 1.0; + this.add(accountLabel, constraints); + + String passwordRequiredProperty = (String) protocolProvider + .getAccountID().getAccountProperties().get( + ProtocolProviderFactory.NO_PASSWORD_REQUIRED); + + boolean isPasswordRequired = true; + if (passwordRequiredProperty != null + && passwordRequiredProperty != "") + { + isPasswordRequired + = !(new Boolean(passwordRequiredProperty).booleanValue()); + } + + if (isPasswordRequired) + { + String password = + (String) protocolProvider.getAccountID() + .getAccountProperties() + .get(ProtocolProviderFactory.PASSWORD); + + passwordField.setText(password); + constraints.gridx = 1; + constraints.gridy = 1; + constraints.anchor = GridBagConstraints.FIRST_LINE_START; + this.add(passwordField, constraints); + } + + constraints.gridx = 2; + constraints.gridy = 0; + constraints.weightx = 0; + this.add(modifyButton, constraints); + this.modifyButton.addActionListener(this); + + constraints.gridx = 2; + constraints.gridy = 1; + constraints.weightx = 0; + this.add(removeButton, constraints); + this.removeButton.addActionListener(this); + } + + public void save() + { + ProtocolProviderFactory providerFactory = + GuiActivator.getProtocolProviderFactory(protocolProvider); + + Map accountProperties + = protocolProvider.getAccountID().getAccountProperties(); + + String password = new String(passwordField.getPassword()); + + if (!password.equals( + accountProperties.get(ProtocolProviderFactory.PASSWORD))) + { + accountProperties.put(ProtocolProviderFactory.PASSWORD, + new String(passwordField.getPassword())); + } + + providerFactory.modifyAccount(protocolProvider, accountProperties); + } + + public void actionPerformed(ActionEvent e) + { + JButton sourceButton = (JButton) e.getSource(); + + if (sourceButton.equals(removeButton)) + { + ProtocolProviderFactory providerFactory = + GuiActivator.getProtocolProviderFactory(protocolProvider); + + if (providerFactory != null) + { + int result = + JOptionPane.showConfirmDialog(this, Messages + .getI18NString("removeAccountMessage").getText(), + Messages.getI18NString("removeAccount").getText(), + JOptionPane.YES_NO_CANCEL_OPTION); + + if (result == JOptionPane.YES_OPTION) + { + ConfigurationService configService = + GuiActivator.getConfigurationService(); + + String prefix = + "net.java.sip.communicator.impl.gui.accounts"; + + List accounts = + configService + .getPropertyNamesByPrefix(prefix, true); + + Iterator accountsIter = accounts.iterator(); + + while (accountsIter.hasNext()) + { + String accountRootPropName = + (String) accountsIter.next(); + + String accountUID = + configService.getString(accountRootPropName); + + if (accountUID.equals(protocolProvider + .getAccountID().getAccountUniqueID())) + { + + configService.setProperty(accountRootPropName, + null); + break; + } + } + providerFactory.uninstallAccount(protocolProvider + .getAccountID()); + } + } + } + else if (sourceButton.equals(modifyButton)) + { + AccountRegWizardContainerImpl wizard = + (AccountRegWizardContainerImpl) GuiActivator.getUIService() + .getAccountRegWizardContainer(); + + wizard.setTitle(Messages.getI18NString( + "accountRegistrationWizard").getText()); + + wizard.modifyAccount(protocolProvider); + wizard.showDialog(false); + } + } + } + + /** + * Returns the title of this configuration form. + * + * @return the title of this configuration form. + */ + public String getTitle() + { + return Messages.getI18NString("accounts").getText(); + } + + /** + * Returns the icon of this configuration form. + * + * @return the icon of this configuration form. + */ + public byte[] getIcon() + { + return ImageLoader.getImageInBytes(ImageLoader.ACCOUNT_ICON); + } + + /** + * Returns the form of this configuration form. + * + * @return the form of this configuration form. + */ + public Object getForm() + { + return this; + } + + /** + * Handles the <tt>ActionEvent</tt> triggered when user clicks on on the + * buttons. Shows the account registration wizard when user clicks on "New". + * + * @param evt the action event that has just occurred. + */ + public void actionPerformed(ActionEvent evt) + { + JButton sourceButton = (JButton) evt.getSource(); + + if (sourceButton.equals(newButton)) + { + NewAccountDialog newAccountDialog = new NewAccountDialog(); + + newAccountDialog.pack(); + newAccountDialog.setVisible(true); + } + else if (sourceButton.equals(saveButton)) + { + Enumeration accountPanels = accounts.elements(); + + while (accountPanels.hasMoreElements()) + { + AccountPanel accountPanel + = (AccountPanel) accountPanels.nextElement(); + + accountPanel.save(); + } + } + } + + /** + * Implements the <tt>ServiceListener</tt> method. Verifies whether the + * passed event concerns a <tt>ProtocolProviderService</tt> and adds the + * corresponding UI controls. + * + * @param event The <tt>ServiceEvent</tt> object. + */ + public void serviceChanged(ServiceEvent event) + { + // if the event is caused by a bundle being stopped, we don't want to + // know + if (event.getServiceReference().getBundle().getState() == Bundle.STOPPING) + { + return; + } + Object sourceService = + GuiActivator.bundleContext.getService(event.getServiceReference()); + + // we don't care if the source service is not a protocol provider + if (!(sourceService instanceof ProtocolProviderService)) + { + return; + } + + ProtocolProviderService pps = (ProtocolProviderService) sourceService; + + if (event.getType() == ServiceEvent.REGISTERED) + { + AccountPanel accountPanel = new AccountPanel(pps); + + this.accountsPanel.add(accountPanel); + this.accountsPanel.revalidate(); + this.accountsPanel.repaint(); + + this.accounts.put(pps, accountPanel); + } + else if (event.getType() == ServiceEvent.UNREGISTERING) + { + this.accountsPanel.remove((JPanel) accounts.get(pps)); + this.accountsPanel.revalidate(); + this.accountsPanel.repaint(); + } + } + + public int getIndex() + { + return 1; + } +} diff --git a/src/net/java/sip/communicator/impl/gui/main/account/NewAccountDialog.java b/src/net/java/sip/communicator/impl/gui/main/account/NewAccountDialog.java new file mode 100644 index 0000000..da40327 --- /dev/null +++ b/src/net/java/sip/communicator/impl/gui/main/account/NewAccountDialog.java @@ -0,0 +1,232 @@ +package net.java.sip.communicator.impl.gui.main.account; + +import java.awt.*; +import java.awt.event.*; + +import javax.swing.*; + +import net.java.sip.communicator.impl.gui.*; +import net.java.sip.communicator.impl.gui.customcontrols.*; +import net.java.sip.communicator.impl.gui.i18n.*; +import net.java.sip.communicator.impl.gui.utils.*; +import net.java.sip.communicator.service.gui.*; +import net.java.sip.communicator.util.*; + +import org.osgi.framework.*; + +public class NewAccountDialog + extends SIPCommDialog + implements ActionListener +{ + private Logger logger = Logger.getLogger(NewAccountDialog.class); + + private JPanel mainPanel = new JPanel(new BorderLayout(5, 5)); + + private JPanel accountPanel = new JPanel(new BorderLayout()); + + private JPanel networkPanel = new JPanel(new FlowLayout(FlowLayout.CENTER)); + + private JLabel networkLabel = new JLabel( + Messages.getI18NString("network").getText()); + + private JComboBox networkComboBox = new JComboBox(); + + private JButton advancedButton = new JButton( + Messages.getI18NString("advanced").getText()); + + private JButton addAccountButton = new JButton( + Messages.getI18NString("newAccount").getText()); + + private JButton cancelButton = new JButton( + Messages.getI18NString("cancel").getText()); + + private JPanel rightButtonPanel + = new JPanel(new FlowLayout(FlowLayout.RIGHT, 0, 0)); + + private JPanel buttonPanel = new JPanel(new BorderLayout()); + + private String preferredWizardName; + + public NewAccountDialog() + { + super(GuiActivator.getUIService().getMainFrame()); + + this.setTitle(Messages.getI18NString("newAccount").getText()); + + this.getContentPane().add(mainPanel); + + this.mainPanel.setBorder( + BorderFactory.createEmptyBorder(15, 15, 15, 15)); + + this.mainPanel.add(buttonPanel, BorderLayout.SOUTH); + this.buttonPanel.add(advancedButton, BorderLayout.WEST); + this.buttonPanel.add(rightButtonPanel, BorderLayout.EAST); + this.advancedButton.addActionListener(this); + + this.rightButtonPanel.add(addAccountButton); + this.rightButtonPanel.add(cancelButton); + this.addAccountButton.addActionListener(this); + this.cancelButton.addActionListener(this); + + this.mainPanel.add(networkPanel, BorderLayout.NORTH); + this.networkPanel.add(networkLabel, BorderLayout.WEST); + this.networkPanel.add(networkComboBox, BorderLayout.CENTER); + + this.getRootPane().setDefaultButton(addAccountButton); + + this.networkComboBox.setRenderer(new NetworkListCellRenderer()); + this.networkComboBox.addActionListener(new ActionListener() + { + public void actionPerformed(ActionEvent e) + { + AccountRegistrationWizard wizard + = (AccountRegistrationWizard) networkComboBox + .getSelectedItem(); + + loadSelectedWizard(wizard); + } + }); + + this.mainPanel.add(accountPanel, BorderLayout.CENTER); + + this.initNetworkList(); + } + + private void initNetworkList() + { + // check for preferred wizard + String prefWName = LoginProperties.getProperty("preferredAccountWizard"); + if(prefWName != null && prefWName.length() > 0) + preferredWizardName = prefWName; + + ServiceReference[] accountWizardRefs = null; + try + { + accountWizardRefs = GuiActivator.bundleContext + .getServiceReferences( + AccountRegistrationWizard.class.getName(), + null); + } + catch (InvalidSyntaxException ex) + { + // this shouldn't happen since we're providing no parameter string + // but let's log just in case. + logger.error( + "Error while retrieving service refs", ex); + return; + } + + // in case we found any, add them in this container. + if (accountWizardRefs != null) + { + logger.debug("Found " + + accountWizardRefs.length + + " already installed providers."); + for (int i = 0; i < accountWizardRefs.length; i++) + { + AccountRegistrationWizard wizard + = (AccountRegistrationWizard) GuiActivator.bundleContext + .getService(accountWizardRefs[i]); + + networkComboBox.addItem(wizard); + + // if we have preferred wizard insert it at first position + if(preferredWizardName != null + && wizard.getClass().getName().equals(preferredWizardName)) + networkComboBox.setSelectedItem(wizard); + } + } + } + + private class NetworkListCellRenderer + extends JLabel + implements ListCellRenderer + { + public NetworkListCellRenderer() + { + this.setOpaque(true); + } + + public Component getListCellRendererComponent(JList list, Object value, + int index, boolean isSelected, boolean cellHasFocus) + { + AccountRegistrationWizard wizard + = (AccountRegistrationWizard) value; + + if (isSelected) + { + setBackground(list.getSelectionBackground()); + setForeground(list.getSelectionForeground()); + } + else + { + setBackground(list.getBackground()); + setForeground(list.getForeground()); + } + + this.setText(wizard.getProtocolName()); + this.setIcon(new ImageIcon( + ImageLoader.getBytesInImage(wizard.getIcon()))); + + return this; + } + } + + private void loadSelectedWizard(AccountRegistrationWizard wizard) + { + accountPanel.removeAll(); + + JPanel fixedWidthPanel = new JPanel(); + this.accountPanel.add(fixedWidthPanel, BorderLayout.SOUTH); + fixedWidthPanel.setPreferredSize(new Dimension(430, 3)); + fixedWidthPanel.setMinimumSize(new Dimension(430, 3)); + fixedWidthPanel.setMaximumSize(new Dimension(430, 3)); + + accountPanel.add((Component) wizard.getSimpleForm(), BorderLayout.NORTH); + accountPanel.revalidate(); + accountPanel.repaint(); + this.pack(); + } + + @Override + protected void close(boolean isEscaped) + { + } + + /** + * + */ + public void actionPerformed(ActionEvent event) + { + JButton sourceButton = (JButton) event.getSource(); + + AccountRegistrationWizard wizard + = (AccountRegistrationWizard) networkComboBox.getSelectedItem(); + + if (sourceButton.equals(advancedButton)) + { + wizard.setModification(false); + + AccountRegWizardContainerImpl wizardContainer + = ((AccountRegWizardContainerImpl) GuiActivator.getUIService() + .getAccountRegWizardContainer()); + + wizardContainer.setTitle(Messages.getI18NString( + "accountRegistrationWizard").getText()); + + wizardContainer.setCurrentWizard(wizard); + + wizardContainer.showDialog(false); + } + else if (sourceButton.equals(addAccountButton)) + { + wizard.signin(); + + this.dispose(); + } + else if (sourceButton.equals(cancelButton)) + { + this.dispose(); + } + } +} diff --git a/src/net/java/sip/communicator/impl/gui/main/chatroomslist/createforms/CreateChatRoomWizardPage1.java b/src/net/java/sip/communicator/impl/gui/main/chatroomslist/createforms/CreateChatRoomWizardPage1.java index afa97fb..709a197 100644 --- a/src/net/java/sip/communicator/impl/gui/main/chatroomslist/createforms/CreateChatRoomWizardPage1.java +++ b/src/net/java/sip/communicator/impl/gui/main/chatroomslist/createforms/CreateChatRoomWizardPage1.java @@ -131,7 +131,7 @@ public class CreateChatRoomWizardPage1 { } - public void pageNext() + public void commitPage() { selectAccountPanel.setSelectedAccount(); } diff --git a/src/net/java/sip/communicator/impl/gui/main/chatroomslist/createforms/CreateChatRoomWizardPage2.java b/src/net/java/sip/communicator/impl/gui/main/chatroomslist/createforms/CreateChatRoomWizardPage2.java index 7aabc2d..69f5b25 100644 --- a/src/net/java/sip/communicator/impl/gui/main/chatroomslist/createforms/CreateChatRoomWizardPage2.java +++ b/src/net/java/sip/communicator/impl/gui/main/chatroomslist/createforms/CreateChatRoomWizardPage2.java @@ -99,7 +99,7 @@ public class CreateChatRoomWizardPage2 namePanel.setNextFinishButtonAccordingToUIN(); } - public void pageNext() + public void commitPage() { } diff --git a/src/net/java/sip/communicator/impl/gui/main/chatroomslist/joinforms/JoinChatRoomWizardPage1.java b/src/net/java/sip/communicator/impl/gui/main/chatroomslist/joinforms/JoinChatRoomWizardPage1.java index e1c6038..0cb1a4e 100644 --- a/src/net/java/sip/communicator/impl/gui/main/chatroomslist/joinforms/JoinChatRoomWizardPage1.java +++ b/src/net/java/sip/communicator/impl/gui/main/chatroomslist/joinforms/JoinChatRoomWizardPage1.java @@ -146,7 +146,7 @@ public class JoinChatRoomWizardPage1 /** * Saves the selected account before going to the next page. */ - public void pageNext() + public void commitPage() { selectAccountPanel.setSelectedAccount(); } diff --git a/src/net/java/sip/communicator/impl/gui/main/chatroomslist/joinforms/JoinChatRoomWizardPage2.java b/src/net/java/sip/communicator/impl/gui/main/chatroomslist/joinforms/JoinChatRoomWizardPage2.java index ff89800..dc96b43 100644 --- a/src/net/java/sip/communicator/impl/gui/main/chatroomslist/joinforms/JoinChatRoomWizardPage2.java +++ b/src/net/java/sip/communicator/impl/gui/main/chatroomslist/joinforms/JoinChatRoomWizardPage2.java @@ -121,7 +121,7 @@ public class JoinChatRoomWizardPage2 { } - public void pageNext() + public void commitPage() { } diff --git a/src/net/java/sip/communicator/impl/gui/main/configforms/AccountsConfigurationForm.java b/src/net/java/sip/communicator/impl/gui/main/configforms/AccountsConfigurationForm.java deleted file mode 100644 index 8a45a34..0000000 --- a/src/net/java/sip/communicator/impl/gui/main/configforms/AccountsConfigurationForm.java +++ /dev/null @@ -1,409 +0,0 @@ -/* - * 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.configforms; - -import java.awt.*; -import java.awt.event.*; -import java.io.*; -import java.util.*; -import java.util.List; - -import javax.imageio.*; -import javax.swing.*; -import javax.swing.table.*; - -import net.java.sip.communicator.impl.gui.*; -import net.java.sip.communicator.impl.gui.customcontrols.*; -import net.java.sip.communicator.impl.gui.i18n.*; -import net.java.sip.communicator.impl.gui.main.*; -import net.java.sip.communicator.impl.gui.main.account.*; -import net.java.sip.communicator.impl.gui.utils.*; -import net.java.sip.communicator.service.configuration.*; -import net.java.sip.communicator.service.gui.*; -import net.java.sip.communicator.service.protocol.*; -import net.java.sip.communicator.util.*; - -import org.osgi.framework.*; - -/** - * The <tt>AccountsConfigurationForm</tt> is the form where the user - * could create, modify or delete an account. - * - * @author Yana Stamcheva - */ -public class AccountsConfigurationForm extends JPanel - implements ConfigurationForm, - ActionListener, - ServiceListener { - - private Logger logger = Logger.getLogger( - AccountsConfigurationForm.class.getName()); - - private JScrollPane tablePane = new JScrollPane(); - - private JTable accountsTable = new JTable(); - - private JPanel rightPanel = new JPanel(new BorderLayout()); - - private JPanel buttonsPanel = new JPanel(new GridLayout(0, 1, 8, 8)); - - private I18NString newString = Messages.getI18NString("new"); - - private I18NString modifyString = Messages.getI18NString("modify"); - - private I18NString removeString = Messages.getI18NString("remove"); - - private JButton newButton = new JButton(newString.getText()); - - private JButton modifyButton = new JButton(modifyString.getText()); - - private JButton removeButton = new JButton(removeString.getText()); - - private ExtendedTableModel tableModel = new ExtendedTableModel(); - - private MainFrame mainFrame; - - /** - * Creates an instance of <tt>AccountsConfigurationForm</tt>. - * - * @param mainFrame the main application window - */ - public AccountsConfigurationForm(MainFrame mainFrame) { - super(new BorderLayout()); - - this.mainFrame = mainFrame; - - GuiActivator.bundleContext.addServiceListener(this); - - this.tableInit(); - - this.buttonsPanelInit(); - - this.add(tablePane, BorderLayout.CENTER); - this.add(rightPanel, BorderLayout.EAST); - - this.setPreferredSize(new Dimension(500, 400)); - } - - /** - * Initializes the buttons panel. - */ - private void buttonsPanelInit() { - this.newButton.addActionListener(this); - this.modifyButton.addActionListener(this); - this.removeButton.addActionListener(this); - - this.newButton.setMnemonic(newString.getMnemonic()); - this.modifyButton.setMnemonic(modifyString.getMnemonic()); - this.removeButton.setMnemonic(removeString.getMnemonic()); - - this.buttonsPanel.add(newButton); - this.buttonsPanel.add(modifyButton); - this.buttonsPanel.add(removeButton); - - this.rightPanel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5)); - this.rightPanel.add(buttonsPanel, BorderLayout.NORTH); - } - - /** - * Initializes the accounts table. - */ - private void tableInit() { - - accountsTable.setRowHeight(22); - accountsTable.setSelectionMode( - - ListSelectionModel.SINGLE_SELECTION); - - accountsTable.setShowHorizontalLines(false); - accountsTable.setShowVerticalLines(false); - accountsTable.setModel(tableModel); - accountsTable.setAutoResizeMode(JTable.AUTO_RESIZE_LAST_COLUMN); - - tableModel.addColumn("id"); - tableModel.addColumn(Messages.getI18NString("protocol").getText()); - tableModel.addColumn(Messages.getI18NString("account").getText()); - - TableColumnModel columnModel = accountsTable.getColumnModel(); - columnModel.removeColumn(columnModel.getColumn(0)); - columnModel.getColumn(0) - .setCellRenderer(new LabelTableCellRenderer()); - columnModel.getColumn(1) - .setCellRenderer(new LabelTableCellRenderer()); - - columnModel.getColumn(0).setPreferredWidth(100); - columnModel.getColumn(1).setPreferredWidth(361); - - this.initializeAccountsTable(); - - this.tablePane.getViewport().add(accountsTable); - } - - /** - * From all protocol provider factories obtains all already registered - * accounts and adds them to the table. - */ - private void initializeAccountsTable() { - Set set = GuiActivator.getProtocolProviderFactories().entrySet(); - Iterator iter = set.iterator(); - - while (iter.hasNext()) { - Map.Entry entry = (Map.Entry) iter.next(); - - ProtocolProviderFactory providerFactory - = (ProtocolProviderFactory) entry.getValue(); - - ArrayList accountsList - = providerFactory.getRegisteredAccounts(); - - AccountID accountID; - ServiceReference serRef; - ProtocolProviderService protocolProvider; - - for (int i = 0; i < accountsList.size(); i ++) { - accountID = (AccountID) accountsList.get(i); - - boolean isHidden = - accountID.getAccountProperties(). - get("HIDDEN_PROTOCOL") != null; - - if(isHidden) - continue; - - serRef = providerFactory - .getProviderForAccount(accountID); - - protocolProvider - = (ProtocolProviderService) GuiActivator.bundleContext - .getService(serRef); - - String pName = protocolProvider.getProtocolDisplayName(); - - Image protocolImage = null; - try - { - protocolImage - = ImageIO.read(new ByteArrayInputStream( - protocolProvider.getProtocolIcon() - .getIcon(ProtocolIcon.ICON_SIZE_16x16))); - } - catch (IOException e) - { - logger.error("Could not read image.", e); - } - - JLabel protocolLabel = new JLabel(); - protocolLabel.setText(pName); - protocolLabel.setIcon(new ImageIcon(protocolImage)); - - tableModel.addRow(new Object[]{protocolProvider, protocolLabel, - accountID.getUserID()}); - } - } - } - - /** - * Returns the title of this configuration form. - * @return the title of this configuration form. - */ - public String getTitle() { - return Messages.getI18NString("accounts").getText(); - } - - /** - * Returns the icon of this configuration form. - * @return the icon of this configuration form. - */ - public byte[] getIcon() { - return ImageLoader.getImageInBytes( - ImageLoader.ACCOUNT_ICON); - } - - /** - * Returns the form of this configuration form. - * @return the form of this configuration form. - */ - public Object getForm() { - return this; - } - - /** - * Handles the <tt>ActionEvent</tt> triggered when user clicks on - * on the buttons. Shows the account registration wizard when user - * clicks on "New". - * - * @param evt the action event that has just occurred. - */ - public void actionPerformed(ActionEvent evt) { - JButton sourceButton = (JButton)evt.getSource(); - - if (sourceButton.equals(newButton)) { - AccountRegWizardContainerImpl wizard - = (AccountRegWizardContainerImpl)GuiActivator.getUIService() - .getAccountRegWizardContainer(); - - wizard.setTitle( - Messages.getI18NString("accountRegistrationWizard").getText()); - - wizard.newAccount(); - - wizard.showDialog(false); - } - else if (sourceButton.equals(modifyButton)) { - - if(accountsTable.getSelectedRow() != -1) { - AccountRegWizardContainerImpl wizard - = (AccountRegWizardContainerImpl)GuiActivator.getUIService() - .getAccountRegWizardContainer(); - - wizard.setTitle( - Messages.getI18NString("accountRegistrationWizard") - .getText()); - - ProtocolProviderService protocolProvider - = (ProtocolProviderService)tableModel.getValueAt( - accountsTable.getSelectedRow(), 0); - - wizard.modifyAccount(protocolProvider); - wizard.showDialog(false); - } - } - else if(sourceButton.equals(removeButton)){ - - if(accountsTable.getSelectedRow() != -1) { - mainFrame.getLoginManager().setManuallyDisconnected(true); - - ProtocolProviderService protocolProvider - = (ProtocolProviderService)tableModel.getValueAt( - accountsTable.getSelectedRow(), 0); - - ProtocolProviderFactory providerFactory - = GuiActivator.getProtocolProviderFactory(protocolProvider); - - if(providerFactory != null) { - int result = JOptionPane.showConfirmDialog(this, - Messages.getI18NString("removeAccountMessage").getText(), - Messages.getI18NString("removeAccount").getText(), - JOptionPane.YES_NO_CANCEL_OPTION); - - if(result == JOptionPane.YES_OPTION) { - ConfigurationService configService - = GuiActivator.getConfigurationService(); - - String prefix - = "net.java.sip.communicator.impl.gui.accounts"; - - List accounts = configService - .getPropertyNamesByPrefix(prefix, true); - - Iterator accountsIter = accounts.iterator(); - - while(accountsIter.hasNext()) { - - String accountRootPropName - = (String) accountsIter.next(); - - String accountUID - = configService.getString(accountRootPropName); - - if(accountUID.equals(protocolProvider - .getAccountID().getAccountUniqueID())) { - - configService.setProperty( - accountRootPropName, - null); - break; - } - } - providerFactory.uninstallAccount( - protocolProvider.getAccountID()); - } - } - } - } - } - - - /** - * Implements the <tt>ServiceListener</tt> method. Verifies whether the - * passed event concerns a <tt>ProtocolProviderService</tt> and adds the - * corresponding UI controls. - * - * @param event The <tt>ServiceEvent</tt> object. - */ - public void serviceChanged(ServiceEvent event) - { - //if the event is caused by a bundle being stopped, we don't want to - //know - if(event.getServiceReference().getBundle().getState() - == Bundle.STOPPING) - { - return; - } - Object sourceService = GuiActivator.bundleContext - .getService(event.getServiceReference()); - - // we don't care if the source service is not a protocol provider - if (! (sourceService instanceof ProtocolProviderService)) { - return; - } - - ProtocolProviderService pps = (ProtocolProviderService) sourceService; - - if (event.getType() == ServiceEvent.REGISTERED) - { - String pName = pps.getProtocolDisplayName(); - - Image protocolImage = null; - try - { - protocolImage = ImageIO.read( - new ByteArrayInputStream(pps.getProtocolIcon() - .getIcon(ProtocolIcon.ICON_SIZE_16x16))); - } - catch (IOException e) - { - logger.error("Could not read image.", e); - } - - JLabel protocolLabel = new JLabel(); - protocolLabel.setText(pName); - protocolLabel.setIcon(new ImageIcon(protocolImage)); - - tableModel.addRow(new Object[]{pps, protocolLabel, - pps.getAccountID().getUserID()}); - } - else if (event.getType() == ServiceEvent.UNREGISTERING) - { - ProtocolProviderFactory sourceFactory = null; - - ServiceReference[] allBundleServices - = event.getServiceReference().getBundle() - .getRegisteredServices(); - - for (int i = 0; i < allBundleServices.length; i++) - { - Object service = GuiActivator.bundleContext - .getService(allBundleServices[i]); - - if(service instanceof ProtocolProviderFactory) - { - sourceFactory = (ProtocolProviderFactory) service; - break; - } - } - - tableModel.removeRow(tableModel.rowIndexOf(pps)); - } - } - - public int getIndex() - { - return 1; - } -} diff --git a/src/net/java/sip/communicator/impl/gui/main/configforms/ConfigurationFrame.java b/src/net/java/sip/communicator/impl/gui/main/configforms/ConfigurationFrame.java index 6fc4017..9b31bca 100644 --- a/src/net/java/sip/communicator/impl/gui/main/configforms/ConfigurationFrame.java +++ b/src/net/java/sip/communicator/impl/gui/main/configforms/ConfigurationFrame.java @@ -15,6 +15,7 @@ import net.java.sip.communicator.impl.gui.*; import net.java.sip.communicator.impl.gui.customcontrols.*; import net.java.sip.communicator.impl.gui.i18n.*; import net.java.sip.communicator.impl.gui.main.*; +import net.java.sip.communicator.impl.gui.main.account.*; import net.java.sip.communicator.impl.gui.utils.Constants; import net.java.sip.communicator.service.gui.*; import net.java.sip.communicator.util.*; @@ -42,10 +43,6 @@ public class ConfigurationFrame private JPanel buttonsPanel = new JPanel(new FlowLayout(FlowLayout.RIGHT)); - private I18NString closeString = Messages.getI18NString("close"); - - private JButton closeButton = new JButton(closeString.getText()); - private MainFrame mainFrame; /** @@ -73,18 +70,6 @@ public class ConfigurationFrame this.mainPanel.add(configList, BorderLayout.WEST); - this.buttonsPanel.add(closeButton); - - this.closeButton.setMnemonic(closeString.getMnemonic()); - - this.closeButton.addActionListener(new ActionListener() - { - public void actionPerformed(ActionEvent e) - { - dispose(); - } - }); - buttonsPanel.setBorder(BorderFactory.createMatteBorder(1, 0, 0, 0, Constants.BORDER_COLOR)); @@ -140,8 +125,6 @@ public class ConfigurationFrame this.configList.setSelectedIndex(0); super.setVisible(true); - - this.closeButton.requestFocus(); } else super.setVisible(false); @@ -174,7 +157,6 @@ public class ConfigurationFrame */ protected void close(boolean isEscaped) { - this.closeButton.doClick(); } /** diff --git a/src/net/java/sip/communicator/impl/gui/main/contactlist/addcontact/AddContactWizardPage1.java b/src/net/java/sip/communicator/impl/gui/main/contactlist/addcontact/AddContactWizardPage1.java index 4891d77..bc0c360 100644 --- a/src/net/java/sip/communicator/impl/gui/main/contactlist/addcontact/AddContactWizardPage1.java +++ b/src/net/java/sip/communicator/impl/gui/main/contactlist/addcontact/AddContactWizardPage1.java @@ -105,7 +105,7 @@ public class AddContactWizardPage1 public void pageShown() { } - public void pageNext() { + public void commitPage() { selectAccountPanel.setSelectedAccounts(); } diff --git a/src/net/java/sip/communicator/impl/gui/main/contactlist/addcontact/AddContactWizardPage2.java b/src/net/java/sip/communicator/impl/gui/main/contactlist/addcontact/AddContactWizardPage2.java index c4623a1..671dd82 100644 --- a/src/net/java/sip/communicator/impl/gui/main/contactlist/addcontact/AddContactWizardPage2.java +++ b/src/net/java/sip/communicator/impl/gui/main/contactlist/addcontact/AddContactWizardPage2.java @@ -116,7 +116,7 @@ public class AddContactWizardPage2 { } - public void pageNext() + public void commitPage() { this.newContact.setGroup(selectGroupPanel.getSelectedGroup()); } diff --git a/src/net/java/sip/communicator/impl/gui/main/contactlist/addcontact/AddContactWizardPage3.java b/src/net/java/sip/communicator/impl/gui/main/contactlist/addcontact/AddContactWizardPage3.java index 7f2f9e8..9fe6230 100644 --- a/src/net/java/sip/communicator/impl/gui/main/contactlist/addcontact/AddContactWizardPage3.java +++ b/src/net/java/sip/communicator/impl/gui/main/contactlist/addcontact/AddContactWizardPage3.java @@ -75,7 +75,7 @@ public class AddContactWizardPage3 implements WizardPage { this.addContactPanel.setNextFinishButtonAccordingToUIN(); } - public void pageNext() { + public void commitPage() { } public void pageBack() { diff --git a/src/net/java/sip/communicator/impl/protocol/irc/ProtocolProviderServiceIrcImpl.java b/src/net/java/sip/communicator/impl/protocol/irc/ProtocolProviderServiceIrcImpl.java index 5dda889..8b19522 100644 --- a/src/net/java/sip/communicator/impl/protocol/irc/ProtocolProviderServiceIrcImpl.java +++ b/src/net/java/sip/communicator/impl/protocol/irc/ProtocolProviderServiceIrcImpl.java @@ -228,10 +228,10 @@ public class ProtocolProviderServiceIrcImpl } if(accountProperties - .get(ProtocolProviderFactory.PASSWORD_REQUIRED) != null) + .get(ProtocolProviderFactory.NO_PASSWORD_REQUIRED) != null) { - passwordRequired = new Boolean((String)accountProperties - .get(ProtocolProviderFactory.PASSWORD_REQUIRED)) + passwordRequired = new Boolean((String) accountProperties + .get(ProtocolProviderFactory.NO_PASSWORD_REQUIRED)) .booleanValue(); } diff --git a/src/net/java/sip/communicator/impl/systray/jdic/SystrayServiceJdicImpl.java b/src/net/java/sip/communicator/impl/systray/jdic/SystrayServiceJdicImpl.java index 0b6c941..672f1ca 100644 --- a/src/net/java/sip/communicator/impl/systray/jdic/SystrayServiceJdicImpl.java +++ b/src/net/java/sip/communicator/impl/systray/jdic/SystrayServiceJdicImpl.java @@ -526,7 +526,7 @@ public class SystrayServiceJdicImpl try { if(toChangeDockIcon != null) - { + { Dock.setDockTileImage(toChangeDockIcon); } else diff --git a/src/net/java/sip/communicator/plugin/aimaccregwizz/AimAccountRegistrationWizard.java b/src/net/java/sip/communicator/plugin/aimaccregwizz/AimAccountRegistrationWizard.java index 0c415bc..c48fa66 100644 --- a/src/net/java/sip/communicator/plugin/aimaccregwizz/AimAccountRegistrationWizard.java +++ b/src/net/java/sip/communicator/plugin/aimaccregwizz/AimAccountRegistrationWizard.java @@ -136,6 +136,10 @@ public class AimAccountRegistrationWizard */ public ProtocolProviderService signin() { + if (!firstWizardPage.isCommitted()) + firstWizardPage.commitPage(); + + firstWizardPage.commitPage(); return this.signin(registration.getUin(), registration.getPassword()); } @@ -354,7 +358,6 @@ public class AimAccountRegistrationWizard "initRegistration.psp?sitedomain=www.aim.com&createSn=1"); } - /** * Returns <code>true</code> if the web sign up is supported by the current * implementation, <code>false</code> - otherwise. @@ -365,4 +368,11 @@ public class AimAccountRegistrationWizard { return true; } + + public Object getSimpleForm() + { + firstWizardPage = new FirstWizardPage(this); + + return firstWizardPage.getSimpleForm(); + } } diff --git a/src/net/java/sip/communicator/plugin/aimaccregwizz/FirstWizardPage.java b/src/net/java/sip/communicator/plugin/aimaccregwizz/FirstWizardPage.java index 151beda..7b530e1 100644 --- a/src/net/java/sip/communicator/plugin/aimaccregwizz/FirstWizardPage.java +++ b/src/net/java/sip/communicator/plugin/aimaccregwizz/FirstWizardPage.java @@ -105,6 +105,8 @@ public class FirstWizardPage private AimAccountRegistrationWizard wizard; + private boolean isCommitted = false; + /** * Creates an instance of <tt>FirstWizardPage</tt>. * @@ -271,7 +273,7 @@ public class FirstWizardPage /** * Saves the user input when the "Next" wizard buttons is clicked. */ - public void pageNext() + public void commitPage() { String uin = uinField.getText(); @@ -307,6 +309,8 @@ public class FirstWizardPage .getPassword())); } } + + isCommitted = true; } /** @@ -447,4 +451,14 @@ public class FirstWizardPage } return false; } + + public Object getSimpleForm() + { + return uinPassPanel; + } + + public boolean isCommitted() + { + return isCommitted; + } } diff --git a/src/net/java/sip/communicator/plugin/dictaccregwizz/DictAccountRegistrationWizard.java b/src/net/java/sip/communicator/plugin/dictaccregwizz/DictAccountRegistrationWizard.java index 8d50810..7fa4f61 100644 --- a/src/net/java/sip/communicator/plugin/dictaccregwizz/DictAccountRegistrationWizard.java +++ b/src/net/java/sip/communicator/plugin/dictaccregwizz/DictAccountRegistrationWizard.java @@ -149,6 +149,9 @@ public class DictAccountRegistrationWizard */ public ProtocolProviderService signin() { + if (!firstWizardPage.isCommitted()) + firstWizardPage.commitPage(); + return signin(registration.getUserID(), null); } @@ -188,6 +191,12 @@ public class DictAccountRegistrationWizard { Hashtable accountProperties = new Hashtable(); + // Set this property to indicate that Dict account does not require + // authentication. + accountProperties.put( + ProtocolProviderFactory.NO_PASSWORD_REQUIRED, + new Boolean(true).toString()); + // Save host accountProperties.put(ProtocolProviderFactory.SERVER_ADDRESS, host); // Save port @@ -426,4 +435,11 @@ public class DictAccountRegistrationWizard { return false; } + + public Object getSimpleForm() + { + firstWizardPage = new FirstWizardPage(this); + + return firstWizardPage.getSimpleForm(); + } } diff --git a/src/net/java/sip/communicator/plugin/dictaccregwizz/FirstWizardPage.java b/src/net/java/sip/communicator/plugin/dictaccregwizz/FirstWizardPage.java index 0282f1d..00d0528 100644 --- a/src/net/java/sip/communicator/plugin/dictaccregwizz/FirstWizardPage.java +++ b/src/net/java/sip/communicator/plugin/dictaccregwizz/FirstWizardPage.java @@ -82,6 +82,8 @@ public class FirstWizardPage private boolean firstAccount = false; + private boolean isPageCommitted = false; + /** * Initial AccountID (null if new account) * Used to check if there are modifications to the account @@ -311,7 +313,7 @@ public class FirstWizardPage /** * Saves the user input when the "Next" wizard buttons is clicked. */ - public void pageNext() + public void commitPage() { //* String host = hostField.getText(); @@ -369,6 +371,7 @@ public class FirstWizardPage registration.setStrategy(this.strategyBox.getSelectedValue().toString()); } //*/ + isPageCommitted = true; } /** @@ -669,4 +672,14 @@ public class FirstWizardPage this.strategyLoader.setEnabled(e); wizard.getWizardContainer().setNextFinishButtonEnabled(e); } + + public Object getSimpleForm() + { + return mainPanel; + } + + public boolean isCommitted() + { + return isPageCommitted; + } } diff --git a/src/net/java/sip/communicator/plugin/gibberishaccregwizz/FirstWizardPage.java b/src/net/java/sip/communicator/plugin/gibberishaccregwizz/FirstWizardPage.java index fc80a6b..798bcc8 100644 --- a/src/net/java/sip/communicator/plugin/gibberishaccregwizz/FirstWizardPage.java +++ b/src/net/java/sip/communicator/plugin/gibberishaccregwizz/FirstWizardPage.java @@ -59,6 +59,8 @@ public class FirstWizardPage private GibberishAccountRegistrationWizard wizard; + private boolean isCommitted = false; + /** * Creates an instance of <tt>FirstWizardPage</tt>. * @param registration the <tt>GibberishAccountRegistration</tt>, where @@ -175,7 +177,7 @@ public class FirstWizardPage /** * Saves the user input when the "Next" wizard buttons is clicked. */ - public void pageNext() + public void commitPage() { String userID = userIDField.getText(); @@ -200,6 +202,8 @@ public class FirstWizardPage registration.setRememberPassword(rememberPassBox.isSelected()); } + + isCommitted = true; } /** @@ -306,4 +310,14 @@ public class FirstWizardPage } return false; } + + public Object getSimpleForm() + { + return userPassPanel; + } + + public boolean isCommitted() + { + return isCommitted; + } } diff --git a/src/net/java/sip/communicator/plugin/gibberishaccregwizz/GibberishAccountRegistrationWizard.java b/src/net/java/sip/communicator/plugin/gibberishaccregwizz/GibberishAccountRegistrationWizard.java index be8d146..7ca29ee 100644 --- a/src/net/java/sip/communicator/plugin/gibberishaccregwizz/GibberishAccountRegistrationWizard.java +++ b/src/net/java/sip/communicator/plugin/gibberishaccregwizz/GibberishAccountRegistrationWizard.java @@ -132,6 +132,9 @@ public class GibberishAccountRegistrationWizard */ public ProtocolProviderService signin() { + if (!firstWizardPage.isCommitted()) + firstWizardPage.commitPage(); + return signin(registration.getUserID(), null); } @@ -335,4 +338,10 @@ public class GibberishAccountRegistrationWizard { return false; } + + public Object getSimpleForm() + { + firstWizardPage = new FirstWizardPage(this); + return firstWizardPage.getSimpleForm(); + } } diff --git a/src/net/java/sip/communicator/plugin/icqaccregwizz/FirstWizardPage.java b/src/net/java/sip/communicator/plugin/icqaccregwizz/FirstWizardPage.java index dc5a364..5c412d6 100644 --- a/src/net/java/sip/communicator/plugin/icqaccregwizz/FirstWizardPage.java +++ b/src/net/java/sip/communicator/plugin/icqaccregwizz/FirstWizardPage.java @@ -104,6 +104,8 @@ public class FirstWizardPage private IcqAccountRegistrationWizard wizard; + private boolean isCommitted = false; + /** * Creates an instance of <tt>FirstWizardPage</tt>. * @@ -273,7 +275,7 @@ public class FirstWizardPage /** * Saves the user input when the "Next" wizard buttons is clicked. */ - public void pageNext() + public void commitPage() { String uin = uinField.getText(); @@ -311,6 +313,8 @@ public class FirstWizardPage new String(proxyPassField.getPassword())); } } + + isCommitted = true; } /** @@ -455,4 +459,14 @@ public class FirstWizardPage } return false; } + + public Object getSimpleForm() + { + return uinPassPanel; + } + + public boolean isCommitted() + { + return isCommitted; + } } diff --git a/src/net/java/sip/communicator/plugin/icqaccregwizz/IcqAccountRegistrationWizard.java b/src/net/java/sip/communicator/plugin/icqaccregwizz/IcqAccountRegistrationWizard.java index 4eee06e..1975a1a 100644 --- a/src/net/java/sip/communicator/plugin/icqaccregwizz/IcqAccountRegistrationWizard.java +++ b/src/net/java/sip/communicator/plugin/icqaccregwizz/IcqAccountRegistrationWizard.java @@ -142,6 +142,9 @@ public class IcqAccountRegistrationWizard */ public ProtocolProviderService signin() { + if (!firstWizardPage.isCommitted()) + firstWizardPage.commitPage(); + return this.signin(registration.getUin(), registration .getPassword()); } @@ -368,4 +371,11 @@ public class IcqAccountRegistrationWizard { return true; } + + public Object getSimpleForm() + { + firstWizardPage = new FirstWizardPage(this); + + return firstWizardPage.getSimpleForm(); + } } diff --git a/src/net/java/sip/communicator/plugin/ircaccregwizz/FirstWizardPage.java b/src/net/java/sip/communicator/plugin/ircaccregwizz/FirstWizardPage.java index e20b2ed..371832e 100644 --- a/src/net/java/sip/communicator/plugin/ircaccregwizz/FirstWizardPage.java +++ b/src/net/java/sip/communicator/plugin/ircaccregwizz/FirstWizardPage.java @@ -105,6 +105,8 @@ public class FirstWizardPage private IrcAccountRegistrationWizard wizard; + private boolean isCommitted = false; + /** * Creates an instance of <tt>FirstWizardPage</tt>. * @@ -281,23 +283,25 @@ public class FirstWizardPage /** * Saves the user input when the "Next" wizard buttons is clicked. */ - public void pageNext() + public void commitPage() { - nextPageIdentifier = SUMMARY_PAGE_IDENTIFIER; - userPassPanel.remove(existingAccountLabel); + nextPageIdentifier = SUMMARY_PAGE_IDENTIFIER; + userPassPanel.remove(existingAccountLabel); + + IrcAccountRegistration registration = wizard.getRegistration(); - IrcAccountRegistration registration = wizard.getRegistration(); + registration.setUserID(nickField.getText()); - registration.setUserID(nickField.getText()); + if (passField.getPassword() != null) + registration.setPassword(new String(passField.getPassword())); - 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()); - registration.setServer(serverField.getText()); - registration.setPort(portField.getText()); - registration.setRememberPassword(rememberPassBox.isSelected()); - registration.setAutoChangeNick(autoNickChange.isSelected()); - registration.setRequiredPassword(!passwordNotRequired.isSelected()); + isCommitted = true; } /** @@ -368,8 +372,8 @@ public class FirstWizardPage String autoNickChange = (String) accountID.getAccountProperties() .get(ProtocolProviderFactory.AUTO_CHANGE_USER_NAME); - String passwordRequired = (String) accountID.getAccountProperties() - .get(ProtocolProviderFactory.PASSWORD_REQUIRED); + String noPasswordRequired = (String) accountID.getAccountProperties() + .get(ProtocolProviderFactory.NO_PASSWORD_REQUIRED); this.nickField.setEnabled(false); this.nickField.setText(accountID.getUserID()); @@ -394,10 +398,10 @@ public class FirstWizardPage new Boolean(autoNickChange).booleanValue()); } - if (passwordRequired != null) + if (noPasswordRequired != null) { boolean isPassRequired - = new Boolean(passwordRequired).booleanValue(); + = !(new Boolean(noPasswordRequired).booleanValue()); this.passwordNotRequired.setSelected(!isPassRequired); @@ -467,4 +471,31 @@ public class FirstWizardPage public void pageShown(){} public void pageBack(){} + + public Object getSimpleForm() + { + JPanel simplePanel = new JPanel(new BorderLayout()); + JPanel labelsPanel = new JPanel(new GridLayout(0, 1)); + JPanel valuesPanel = new JPanel(new GridLayout(0, 1)); + + simplePanel.add(labelsPanel, BorderLayout.WEST); + simplePanel.add(valuesPanel, BorderLayout.CENTER); + + labelsPanel.add(nick); + labelsPanel.add(emptyPanel); + labelsPanel.add(server); + labelsPanel.add(emptyPanel2); + + valuesPanel.add(nickField); + valuesPanel.add(nickExampleLabel); + valuesPanel.add(serverField); + valuesPanel.add(serverExampleLabel); + + return simplePanel; + } + + public boolean isCommitted() + { + return isCommitted; + } } diff --git a/src/net/java/sip/communicator/plugin/ircaccregwizz/IrcAccountRegistrationWizard.java b/src/net/java/sip/communicator/plugin/ircaccregwizz/IrcAccountRegistrationWizard.java index 3da56f8..fb64551 100644 --- a/src/net/java/sip/communicator/plugin/ircaccregwizz/IrcAccountRegistrationWizard.java +++ b/src/net/java/sip/communicator/plugin/ircaccregwizz/IrcAccountRegistrationWizard.java @@ -141,6 +141,9 @@ public class IrcAccountRegistrationWizard */ public ProtocolProviderService signin() { + if (!firstWizardPage.isCommitted()) + firstWizardPage.commitPage(); + String password = null; if (registration.isRememberPassword() && registration.isRequiredPassword()) @@ -200,8 +203,8 @@ public class IrcAccountRegistrationWizard new Boolean(registration.isAutoChangeNick()).toString()); accountProperties.put( - ProtocolProviderFactory.PASSWORD_REQUIRED, - new Boolean(registration.isRequiredPassword()).toString()); + ProtocolProviderFactory.NO_PASSWORD_REQUIRED, + new Boolean(!registration.isRequiredPassword()).toString()); if (isModification) { @@ -368,4 +371,11 @@ public class IrcAccountRegistrationWizard { return false; } + + public Object getSimpleForm() + { + firstWizardPage = new FirstWizardPage(this); + + return firstWizardPage.getSimpleForm(); + } } diff --git a/src/net/java/sip/communicator/plugin/jabberaccregwizz/FirstWizardPage.java b/src/net/java/sip/communicator/plugin/jabberaccregwizz/FirstWizardPage.java index a3ac85b..f04a337 100644 --- a/src/net/java/sip/communicator/plugin/jabberaccregwizz/FirstWizardPage.java +++ b/src/net/java/sip/communicator/plugin/jabberaccregwizz/FirstWizardPage.java @@ -109,6 +109,8 @@ public class FirstWizardPage private JabberAccountRegistrationWizard wizard; + private boolean isCommitted = false; + /** * Creates an instance of <tt>FirstWizardPage</tt>. * @@ -357,7 +359,7 @@ public class FirstWizardPage /** * Saves the user input when the "Next" wizard buttons is clicked. */ - public void pageNext() + public void commitPage() { String userID = userIDField.getText(); @@ -389,6 +391,8 @@ public class FirstWizardPage registration.setPriority( Integer.parseInt(priorityField.getText())); } + + isCommitted = true; } /** @@ -577,4 +581,14 @@ public class FirstWizardPage } return false; } + + public Object getSimpleForm() + { + return userIDPassPanel; + } + + public boolean isCommitted() + { + return isCommitted; + } } diff --git a/src/net/java/sip/communicator/plugin/jabberaccregwizz/JabberAccountRegistrationWizard.java b/src/net/java/sip/communicator/plugin/jabberaccregwizz/JabberAccountRegistrationWizard.java index 3aa347d..f5c67d6 100644 --- a/src/net/java/sip/communicator/plugin/jabberaccregwizz/JabberAccountRegistrationWizard.java +++ b/src/net/java/sip/communicator/plugin/jabberaccregwizz/JabberAccountRegistrationWizard.java @@ -148,6 +148,9 @@ public class JabberAccountRegistrationWizard */ public ProtocolProviderService signin() { + if (!firstWizardPage.isCommitted()) + firstWizardPage.commitPage(); + return signin( registration.getUserID(), registration.getPassword()); } @@ -396,4 +399,10 @@ public class JabberAccountRegistrationWizard { return true; } + + public Object getSimpleForm() + { + firstWizardPage = new FirstWizardPage(this); + return firstWizardPage.getSimpleForm(); + } } diff --git a/src/net/java/sip/communicator/plugin/msnaccregwizz/FirstWizardPage.java b/src/net/java/sip/communicator/plugin/msnaccregwizz/FirstWizardPage.java index 22eee0a..a4e17bd 100644 --- a/src/net/java/sip/communicator/plugin/msnaccregwizz/FirstWizardPage.java +++ b/src/net/java/sip/communicator/plugin/msnaccregwizz/FirstWizardPage.java @@ -60,6 +60,8 @@ public class FirstWizardPage private MsnAccountRegistrationWizard wizard; + private boolean isCommitted = false; + /** * Creates an instance of <tt>FirstWizardPage</tt>. * @@ -168,7 +170,7 @@ public class FirstWizardPage /** * Saves the user input when the "Next" wizard buttons is clicked. */ - public void pageNext() + public void commitPage() { String uin = uinField.getText(); @@ -193,6 +195,8 @@ public class FirstWizardPage registration.setRememberPassword(rememberPassBox.isSelected()); } + + isCommitted = true; } /** @@ -286,4 +290,14 @@ public class FirstWizardPage } return false; } + + public Object getSimpleForm() + { + return mainPanel; + } + + public boolean isCommitted() + { + return isCommitted; + } } diff --git a/src/net/java/sip/communicator/plugin/msnaccregwizz/MsnAccountRegistrationWizard.java b/src/net/java/sip/communicator/plugin/msnaccregwizz/MsnAccountRegistrationWizard.java index 394c5c7..596ebf4 100644 --- a/src/net/java/sip/communicator/plugin/msnaccregwizz/MsnAccountRegistrationWizard.java +++ b/src/net/java/sip/communicator/plugin/msnaccregwizz/MsnAccountRegistrationWizard.java @@ -133,6 +133,9 @@ public class MsnAccountRegistrationWizard */ public ProtocolProviderService signin() { + if (!firstWizardPage.isCommitted()) + firstWizardPage.commitPage(); + return signin( registration.getId(), registration.getPassword()); } @@ -343,4 +346,10 @@ public class MsnAccountRegistrationWizard { return true; } + + public Object getSimpleForm() + { + firstWizardPage = new FirstWizardPage(this); + return firstWizardPage.getSimpleForm(); + } } diff --git a/src/net/java/sip/communicator/plugin/rssaccregwizz/FirstWizardPage.java b/src/net/java/sip/communicator/plugin/rssaccregwizz/FirstWizardPage.java index b06c190..acad84b 100644 --- a/src/net/java/sip/communicator/plugin/rssaccregwizz/FirstWizardPage.java +++ b/src/net/java/sip/communicator/plugin/rssaccregwizz/FirstWizardPage.java @@ -57,6 +57,8 @@ public class FirstWizardPage private WizardContainer wizardContainer; + private boolean isCommitted = false; + /** * Creates an instance of <tt>FirstWizardPage</tt>. * @param registration the <tt>RssAccountRegistration</tt>, where @@ -173,11 +175,13 @@ public class FirstWizardPage /** * Saves the user input when the "Next" wizard buttons is clicked. */ - public void pageNext() + public void commitPage() { nextPageIdentifier = SUMMARY_PAGE_IDENTIFIER; registration.setUserID("RSS"); + + isCommitted = true; } /** @@ -273,4 +277,14 @@ public class FirstWizardPage } return false; } + + public Object getSimpleForm() + { + return labelsPanel; + } + + public boolean isCommitted() + { + return isCommitted; + } } diff --git a/src/net/java/sip/communicator/plugin/rssaccregwizz/RssAccountRegistrationWizard.java b/src/net/java/sip/communicator/plugin/rssaccregwizz/RssAccountRegistrationWizard.java index ffa491f..95461cb 100644 --- a/src/net/java/sip/communicator/plugin/rssaccregwizz/RssAccountRegistrationWizard.java +++ b/src/net/java/sip/communicator/plugin/rssaccregwizz/RssAccountRegistrationWizard.java @@ -133,6 +133,9 @@ public class RssAccountRegistrationWizard */ public ProtocolProviderService signin() { + if (!firstWizardPage.isCommitted()) + firstWizardPage.commitPage(); + return signin(registration.getUserID(), null); } @@ -164,6 +167,10 @@ public class RssAccountRegistrationWizard Hashtable accountProperties = new Hashtable(); + accountProperties.put( + ProtocolProviderFactory.NO_PASSWORD_REQUIRED, + new Boolean(true).toString()); + try { AccountID accountID = providerFactory.installAccount( @@ -299,4 +306,10 @@ public class RssAccountRegistrationWizard { return false; } + + public Object getSimpleForm() + { + firstWizardPage = new FirstWizardPage(registration, wizardContainer); + return firstWizardPage.getSimpleForm(); + } } diff --git a/src/net/java/sip/communicator/plugin/sipaccregwizz/FirstWizardPage.java b/src/net/java/sip/communicator/plugin/sipaccregwizz/FirstWizardPage.java index c35af78..e7c24ad 100644 --- a/src/net/java/sip/communicator/plugin/sipaccregwizz/FirstWizardPage.java +++ b/src/net/java/sip/communicator/plugin/sipaccregwizz/FirstWizardPage.java @@ -150,6 +150,8 @@ public class FirstWizardPage private SIPAccountRegistrationWizard wizard; + private boolean isCommitted = false; + /** * Creates an instance of <tt>FirstWizardPage</tt>. * @@ -387,7 +389,7 @@ public class FirstWizardPage /** * Saves the user input when the "Next" wizard buttons is clicked. */ - public void pageNext() + public void commitPage() { String uin = uinField.getText(); int indexOfSeparator = uin.indexOf('@'); @@ -433,6 +435,8 @@ public class FirstWizardPage keepAliveMethodBox.getSelectedItem().toString()); registration.setKeepAliveInterval(keepAliveIntervalValue.getText()); } + + this.isCommitted = true; } /** @@ -664,4 +668,14 @@ public class FirstWizardPage } return false; } + + public Object getSimpleForm() + { + return uinPassPanel; + } + + public boolean isCommitted() + { + return isCommitted; + } } diff --git a/src/net/java/sip/communicator/plugin/sipaccregwizz/SIPAccountRegistrationWizard.java b/src/net/java/sip/communicator/plugin/sipaccregwizz/SIPAccountRegistrationWizard.java index 5b3482b..3b7daff 100644 --- a/src/net/java/sip/communicator/plugin/sipaccregwizz/SIPAccountRegistrationWizard.java +++ b/src/net/java/sip/communicator/plugin/sipaccregwizz/SIPAccountRegistrationWizard.java @@ -170,6 +170,9 @@ public class SIPAccountRegistrationWizard */ public ProtocolProviderService signin() { + if (!firstWizardPage.isCommitted()) + firstWizardPage.commitPage(); + return signin(registration.getId(), registration.getPassword()); } @@ -438,4 +441,10 @@ public class SIPAccountRegistrationWizard { return true; } + + public Object getSimpleForm() + { + firstWizardPage = new FirstWizardPage(this); + return firstWizardPage.getSimpleForm(); + } } diff --git a/src/net/java/sip/communicator/plugin/sshaccregwizz/FirstWizardPage.java b/src/net/java/sip/communicator/plugin/sshaccregwizz/FirstWizardPage.java index dcb9929..7a415e9 100644 --- a/src/net/java/sip/communicator/plugin/sshaccregwizz/FirstWizardPage.java +++ b/src/net/java/sip/communicator/plugin/sshaccregwizz/FirstWizardPage.java @@ -33,7 +33,6 @@ import net.java.sip.communicator.impl.protocol.ssh.*; public class FirstWizardPage extends JPanel implements WizardPage, DocumentListener { - public static final String FIRST_PAGE_IDENTIFIER = "FirstPageIdentifier"; private JPanel accountPanel = new JPanel(new BorderLayout(10, 10)); @@ -97,6 +96,8 @@ public class FirstWizardPage private WizardContainer wizardContainer; + private boolean isCommitted = false; + /** * Creates an instance of <tt>FirstWizardPage</tt>. * @param registration the <tt>SSHAccountRegistration</tt>, where @@ -308,7 +309,7 @@ public class FirstWizardPage /** * Saves the user input when the "Next" wizard buttons is clicked. */ - public void pageNext() + public void commitPage() { String userID = accountIDField.getText(); @@ -327,6 +328,7 @@ public class FirstWizardPage registration.setIdentityFile(identityFileField.getText()); registration.setKnownHostsFile(knownHostsFileField.getText()); } + isCommitted = true; } /** @@ -412,4 +414,14 @@ public class FirstWizardPage } return false; } + + public Object getSimpleForm() + { + return accountPanel; + } + + public boolean isCommitted() + { + return isCommitted; + } } diff --git a/src/net/java/sip/communicator/plugin/sshaccregwizz/SSHAccountRegistrationWizard.java b/src/net/java/sip/communicator/plugin/sshaccregwizz/SSHAccountRegistrationWizard.java index beb937b..75eed15 100644 --- a/src/net/java/sip/communicator/plugin/sshaccregwizz/SSHAccountRegistrationWizard.java +++ b/src/net/java/sip/communicator/plugin/sshaccregwizz/SSHAccountRegistrationWizard.java @@ -146,6 +146,9 @@ public class SSHAccountRegistrationWizard */ public ProtocolProviderService signin() { + if (!firstWizardPage.isCommitted()) + firstWizardPage.commitPage(); + return signin(registration.getAccountID(), null); } @@ -180,6 +183,10 @@ public class SSHAccountRegistrationWizard Hashtable accountProperties = new Hashtable(); + accountProperties.put( + ProtocolProviderFactory.NO_PASSWORD_REQUIRED, + new Boolean(true).toString()); + accountProperties.put(ProtocolProviderFactorySSHImpl.IDENTITY_FILE, registration.getIdentityFile()); @@ -308,4 +315,10 @@ public class SSHAccountRegistrationWizard { return false; } + + public Object getSimpleForm() + { + firstWizardPage = new FirstWizardPage(registration, wizardContainer); + return firstWizardPage.getSimpleForm(); + } } diff --git a/src/net/java/sip/communicator/plugin/yahooaccregwizz/FirstWizardPage.java b/src/net/java/sip/communicator/plugin/yahooaccregwizz/FirstWizardPage.java index a55a513..c5c86cf 100644 --- a/src/net/java/sip/communicator/plugin/yahooaccregwizz/FirstWizardPage.java +++ b/src/net/java/sip/communicator/plugin/yahooaccregwizz/FirstWizardPage.java @@ -62,6 +62,8 @@ public class FirstWizardPage private YahooAccountRegistrationWizard wizard; + private boolean isCommitted = false; + /** * Creates an instance of <tt>FirstWizardPage</tt>. * @@ -170,7 +172,7 @@ public class FirstWizardPage /** * Saves the user input when the "Next" wizard buttons is clicked. */ - public void pageNext() + public void commitPage() { String uin = uinField.getText(); @@ -191,6 +193,7 @@ public class FirstWizardPage registration.setPassword(new String(passField.getPassword())); registration.setRememberPassword(rememberPassBox.isSelected()); } + isCommitted = true; } /** @@ -285,4 +288,14 @@ public class FirstWizardPage } return false; } + + public Object getSimpleForm() + { + return uinPassPanel; + } + + public boolean isCommitted() + { + return isCommitted; + } } diff --git a/src/net/java/sip/communicator/plugin/yahooaccregwizz/YahooAccountRegistrationWizard.java b/src/net/java/sip/communicator/plugin/yahooaccregwizz/YahooAccountRegistrationWizard.java index da0d8e1..1064cfa 100644 --- a/src/net/java/sip/communicator/plugin/yahooaccregwizz/YahooAccountRegistrationWizard.java +++ b/src/net/java/sip/communicator/plugin/yahooaccregwizz/YahooAccountRegistrationWizard.java @@ -132,6 +132,9 @@ public class YahooAccountRegistrationWizard */ public ProtocolProviderService signin() { + if (!firstWizardPage.isCommitted()) + firstWizardPage.commitPage(); + return signin( registration.getUin(), registration.getPassword()); } @@ -338,4 +341,11 @@ public class YahooAccountRegistrationWizard { return true; } + + public Object getSimpleForm() + { + firstWizardPage = new FirstWizardPage(this); + + return firstWizardPage.getSimpleForm(); + } } diff --git a/src/net/java/sip/communicator/plugin/zeroconfaccregwizz/FirstWizardPage.java b/src/net/java/sip/communicator/plugin/zeroconfaccregwizz/FirstWizardPage.java index a612ca3..0c13dab 100644 --- a/src/net/java/sip/communicator/plugin/zeroconfaccregwizz/FirstWizardPage.java +++ b/src/net/java/sip/communicator/plugin/zeroconfaccregwizz/FirstWizardPage.java @@ -69,6 +69,8 @@ public class FirstWizardPage private ZeroconfAccountRegistrationWizard wizard; + private boolean isCommitted = false; + /** * Creates an instance of <tt>FirstWizardPage</tt>. * @@ -152,7 +154,6 @@ public class FirstWizardPage valuesPanel.add(lastExampleLabel); valuesPanel.add(mailField); valuesPanel.add(mailExampleLabel); - userPassPanel.add(labelsPanel, BorderLayout.WEST); userPassPanel.add(valuesPanel, BorderLayout.CENTER); @@ -221,7 +222,7 @@ public class FirstWizardPage /** * Saves the user input when the "Next" wizard buttons is clicked. */ - public void pageNext() + public void commitPage() { String userID = userIDField.getText(); @@ -247,6 +248,8 @@ public class FirstWizardPage registration.setRememberContacts(rememberContacts.isSelected()); } + + isCommitted = true; } /** @@ -369,4 +372,19 @@ public class FirstWizardPage } return false; } + + public Object getSimpleForm() + { + JPanel simplePanel = new JPanel(new BorderLayout()); + + simplePanel.add(userID, BorderLayout.WEST); + simplePanel.add(userIDField, BorderLayout.CENTER); + + return simplePanel; + } + + public boolean isCommitted() + { + return isCommitted; + } } diff --git a/src/net/java/sip/communicator/plugin/zeroconfaccregwizz/ZeroconfAccountRegistrationWizard.java b/src/net/java/sip/communicator/plugin/zeroconfaccregwizz/ZeroconfAccountRegistrationWizard.java index b7cd6be..57dcee4 100644 --- a/src/net/java/sip/communicator/plugin/zeroconfaccregwizz/ZeroconfAccountRegistrationWizard.java +++ b/src/net/java/sip/communicator/plugin/zeroconfaccregwizz/ZeroconfAccountRegistrationWizard.java @@ -138,6 +138,9 @@ public class ZeroconfAccountRegistrationWizard */ public ProtocolProviderService signin() { + if (!firstWizardPage.isCommitted()) + firstWizardPage.commitPage(); + return signin(registration.getUserID(), null); } @@ -175,6 +178,10 @@ public class ZeroconfAccountRegistrationWizard accountProperties.put("last", registration.getLast()); accountProperties.put("mail", registration.getMail()); + accountProperties.put( + ProtocolProviderFactory.NO_PASSWORD_REQUIRED, + new Boolean(true).toString()); + accountProperties.put("rememberContacts", new Boolean(registration.isRememberContacts()).toString()); @@ -364,4 +371,10 @@ public class ZeroconfAccountRegistrationWizard { return false; } + + public Object getSimpleForm() + { + firstWizardPage = new FirstWizardPage(this); + return firstWizardPage.getSimpleForm(); + } } diff --git a/src/net/java/sip/communicator/service/gui/AccountRegistrationWizard.java b/src/net/java/sip/communicator/service/gui/AccountRegistrationWizard.java index 72b6fb5..e5d8dc2 100644 --- a/src/net/java/sip/communicator/service/gui/AccountRegistrationWizard.java +++ b/src/net/java/sip/communicator/service/gui/AccountRegistrationWizard.java @@ -183,4 +183,13 @@ public interface AccountRegistrationWizard * <code>false</code> otherwise. */ public boolean isSimpleFormEnabled(); + + /** + * Returns a simple account registration form that would be the first form + * shown to the user. Only if the user needs more settings she'll choose + * to open the advanced wizard, consisted by all pages. + * + * @return a simple account registration form + */ + public Object getSimpleForm(); } diff --git a/src/net/java/sip/communicator/service/gui/WizardPage.java b/src/net/java/sip/communicator/service/gui/WizardPage.java index 7bbed66..e81626e 100644 --- a/src/net/java/sip/communicator/service/gui/WizardPage.java +++ b/src/net/java/sip/communicator/service/gui/WizardPage.java @@ -122,7 +122,7 @@ public interface WizardPage { * here all operations you need to be executed when user clicks "Next" on * this <tt>WizardPage</tt>. */ - public void pageNext(); + public void commitPage(); /** * Invoked when user clicks on the "Back" wizard button. You should add diff --git a/src/net/java/sip/communicator/service/gui/event/AccountRegistrationEvent.java b/src/net/java/sip/communicator/service/gui/event/AccountRegistrationEvent.java deleted file mode 100644 index ccd4a69..0000000 --- a/src/net/java/sip/communicator/service/gui/event/AccountRegistrationEvent.java +++ /dev/null @@ -1,58 +0,0 @@ -/* - * 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.service.gui.event; - -import java.util.*; - -/** - * The <tt>AccountRegistrationEvent</tt> indicates that an - * <tt>AccountRegistrationWizard</tt> is added or removed from an - * <tt>AccountRegistrationWizardContainer</tt>. - * - * @author Yana Stamcheva - */ -public class AccountRegistrationEvent - extends EventObject{ - - private int eventID = -1; - - /** - * Indicates that the AccountRegistrationEvent instance was triggered by - * adding a new <tt>AccountRegistrationWizard</tt> to the - * <tt>AccountRegistrationWizardContainer</tt>. - */ - public static final int REGISTRATION_ADDED = 1; - - /** - * Indicates that the AccountRegistrationEvent instance was triggered by - * the removal of an existing <tt>AccountRegistrationWizard</tt> from the - * <tt>AccountRegistrationWizardContainer</tt>. - */ - public static final int REGISTRATION_REMOVED = 2; - - /** - * Creates a new <tt>AccountRegistrationEvent</tt> according to the - * specified parameters. - * @param source The <tt>AccountRegistrationWizard</tt> that is added to - * supported containers. - * @param eventID one of the REGISTRATION_XXX static fields indicating the - * nature of the event. - */ - public AccountRegistrationEvent(Object source, int eventID) { - super(source); - this.eventID = eventID; - } - - /** - * Returns an event id specifying whether the type of this event - * (REGISTRATION_ADDED or REGISTRATION_REMOVED) - * @return one of the REGISTRATION_XXX int fields of this class. - */ - public int getEventID(){ - return eventID; - } -} diff --git a/src/net/java/sip/communicator/service/gui/event/AccountRegistrationListener.java b/src/net/java/sip/communicator/service/gui/event/AccountRegistrationListener.java deleted file mode 100644 index 6e0e3e7..0000000 --- a/src/net/java/sip/communicator/service/gui/event/AccountRegistrationListener.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * 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.service.gui.event; - -import java.util.*; - -/** - * Listens for all events caused by adding or removing of an - * <tt>AccountRegistrationWizard</tt> to or from an - * <tt>AccountRegistrationWizardContainer</tt>. - * - * @author Yana Stamcheva - */ -public interface AccountRegistrationListener extends EventListener { - - /** - * Indicates that an <tt>AccountRegistrationWizard</tt> has been - * successfully added to an <tt>AccountRegistrationWizardContainer</tt>. - * - * @param event the AccountRegistrationEvent containing the corresponding - * wizard. - */ - public void accountRegistrationAdded(AccountRegistrationEvent event); - - /** - * Indicates that an <tt>AccountRegistrationWizard</tt> has been - * successfully removed from an <tt>AccountRegistrationWizardContainer</tt> - * - * @param event the AccountRegistrationEvent containing the corresponding - * wizard. - */ - public void accountRegistrationRemoved(AccountRegistrationEvent event); -} diff --git a/src/net/java/sip/communicator/service/protocol/ProtocolProviderFactory.java b/src/net/java/sip/communicator/service/protocol/ProtocolProviderFactory.java index b01fe84..ca573eb 100644 --- a/src/net/java/sip/communicator/service/protocol/ProtocolProviderFactory.java +++ b/src/net/java/sip/communicator/service/protocol/ProtocolProviderFactory.java @@ -152,7 +152,7 @@ public abstract class ProtocolProviderFactory * indicating if a password is required. Initially this property is meant to * be used by IRC implementations. */ - public static final String PASSWORD_REQUIRED = "PASSWORD_REQUIRED"; + public static final String NO_PASSWORD_REQUIRED = "NO_PASSWORD_REQUIRED"; /** * The name of the property under which we store if the presence is enabled. |