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 a017c25cb..113f07b11 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 @@ -236,10 +236,12 @@ public void pageNext() { Iterator i = wizard.getPages(); boolean firstPage = true; + Object identifier = null; + while(i.hasNext()) { WizardPage page = (WizardPage)i.next(); - Object identifier = page.getIdentifier(); + identifier = page.getIdentifier(); if(firstPage) { firstPage = false; @@ -249,6 +251,9 @@ public void pageNext() { this.wizardContainer.registerWizardPage(identifier, page); } + + this.wizardContainer.getSummaryPage() + .setPreviousPageIdentifier(identifier); } public void pageBack() { 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 913001910..cae217e65 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 @@ -13,6 +13,7 @@ import javax.swing.JLabel; import javax.swing.JPanel; +import javax.swing.JScrollPane; import net.java.sip.communicator.service.gui.AccountRegistrationWizard; import net.java.sip.communicator.service.gui.WizardPage; @@ -23,7 +24,7 @@ * * @author Yana Stamcheva */ -public class AccountRegSummaryPage extends JPanel +public class AccountRegSummaryPage extends JScrollPane implements WizardPage { private String backPageIdentifier; @@ -32,23 +33,39 @@ public class AccountRegSummaryPage extends JPanel private JPanel valuesPanel = new JPanel(new GridLayout(0, 1, 10, 10)); - private JPanel mainPanel = new JPanel(new BorderLayout()); + private JPanel mainPanel = new JPanel(new BorderLayout(10, 10)); + + private JPanel wrapPanel = new JPanel(new BorderLayout()); private AccountRegWizardContainerImpl wizardContainer; + private Object previousPageIdentifier; + + /** + * Creates an AccountRegSummaryPage. + * + * @param wizardContainer The account registration wizard container + * where this summary page is registered. + */ public AccountRegSummaryPage( AccountRegWizardContainerImpl wizardContainer) { - super(new BorderLayout()); + super(); this.wizardContainer = wizardContainer; this.mainPanel.add(keysPanel, BorderLayout.WEST); this.mainPanel.add(valuesPanel, BorderLayout.CENTER); - this.add(mainPanel, BorderLayout.NORTH); + this.wrapPanel.add(mainPanel, BorderLayout.NORTH); + + this.getViewport().add(wrapPanel); } + /** + * Initializes the summary with the data. + * @param summaryData The data to insert in the summary page. + */ private void init(Iterator summaryData) { while(summaryData.hasNext()) { Map.Entry entry = (Map.Entry)summaryData.next(); @@ -61,39 +78,78 @@ private void init(Iterator summaryData) { } } + /** + * Implements the WizardPage.getIdentifier method. + * @return the page identifier, which in this case is the + * SUMMARY_PAGE_IDENTIFIER + */ public Object getIdentifier() { return WizardPage.SUMMARY_PAGE_IDENTIFIER; } + /** + * Implements the WizardPage.getNextPageIdentifier method. + * @return the FINISH_PAGE_IDENTIFIER to indicate that this is the last + * wizard page + */ public Object getNextPageIdentifier() { return WizardPage.FINISH_PAGE_IDENTIFIER; } + /** + * Implements the WizardPage.getBackPageIdentifier method. + * @return the previous page + */ public Object getBackPageIdentifier() { - return WizardPage.DEFAULT_PAGE_IDENTIFIER; + return getPreviousPageIdentifier(); } + /** + * Implements the WizardPage.getWizardForm method. + * @return this panel + */ public Object getWizardForm() { return this; } - - public void pageHiding() { - } - - public void pageShown() { - } - + + /** + * Before the panel is displayed obtains the summary data from the + * current wizard. + */ public void pageShowing() { AccountRegistrationWizard wizard = this.wizardContainer.getFirstPage().getCurrentWizard(); + this.keysPanel.removeAll(); + this.valuesPanel.removeAll(); + this.init(wizard.getSummary()); } + /** + * Implements the WizardPage.pageNext method, which is invoked + * from the wizard container when user clicks the "Next" button. We invoke + * here the wizard finish method. + */ public void pageNext() { this.wizardContainer.getFirstPage().getCurrentWizard().finish(); } public void pageBack() { } + + public void pageHiding() { + } + + public void pageShown() { + } + + public Object getPreviousPageIdentifier() { + return previousPageIdentifier; + } + + public void setPreviousPageIdentifier(Object previousPageIdentifier) { + this.previousPageIdentifier = previousPageIdentifier; + } + } 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 09d22673a..9fd125ce6 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 @@ -19,6 +19,7 @@ import net.java.sip.communicator.util.Logger; /** + * The implementation of the AccountRegistrationWizardContainer. * * @author Yana Stamcheva */ @@ -92,7 +93,8 @@ public void removeAccountRegistrationWizard( * * @param l the listener to add */ - public void addAccountRegistrationListener(AccountRegistrationListener l) { + public void addAccountRegistrationListener( + AccountRegistrationListener l) { synchronized (accountRegListeners) { this.accountRegListeners.add(l); @@ -104,7 +106,8 @@ public void addAccountRegistrationListener(AccountRegistrationListener l) { * * @param l the listener to remove */ - public void removeAccountRegistrationListener(AccountRegistrationListener l) { + public void removeAccountRegistrationListener( + AccountRegistrationListener l) { synchronized (accountRegListeners) { this.accountRegListeners.remove(l); @@ -157,4 +160,8 @@ private void fireAccountRegistrationEvent(AccountRegistrationWizard wizard, public AccountRegFirstPage getFirstPage() { return firstPage; } + + public AccountRegSummaryPage getSummaryPage() { + return summaryPage; + } } 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 index d32aafd3b..8637193ed 100644 --- a/src/net/java/sip/communicator/impl/gui/main/configforms/AccountsConfigurationForm.java +++ b/src/net/java/sip/communicator/impl/gui/main/configforms/AccountsConfigurationForm.java @@ -33,10 +33,12 @@ import net.java.sip.communicator.impl.gui.main.account.AccountRegWizardContainerImpl; import net.java.sip.communicator.impl.gui.utils.Constants; import net.java.sip.communicator.impl.gui.utils.ImageLoader; -import net.java.sip.communicator.service.gui.AccountRegistrationWizardContainer; import net.java.sip.communicator.service.protocol.ProtocolProviderService; /** + * The AccountsConfigurationForm is the form where the user + * could create, modify or delete an account. + * * @author Yana Stamcheva */ public class AccountsConfigurationForm extends JPanel @@ -60,6 +62,11 @@ public class AccountsConfigurationForm extends JPanel private MainFrame mainFrame; + /** + * Creates an instance of AccountsConfigurationForm. + * + * @param mainFrame the main application window + */ public AccountsConfigurationForm(MainFrame mainFrame) { super(new BorderLayout()); @@ -94,6 +101,7 @@ private void buttonsPanelInit() { */ private void tableInit() { + accountsTable.setRowHeight(22); accountsTable.setSelectionMode( ListSelectionModel.SINGLE_INTERVAL_SELECTION); @@ -128,19 +136,36 @@ private void tableInit() { this.tablePane.getViewport().add(accountsTable); } + /** + * Returns the title of this configuration form. + * @return the title of this configuration form. + */ public String getTitle() { return Messages.getString("accounts"); } + /** + * Returns the icon of this configuration form. + * @return the icon of this configuration form. + */ public Icon getIcon() { return new ImageIcon(ImageLoader .getImage(ImageLoader.QUICK_MENU_ADD_ICON)); } + /** + * Returns the form of this configuration form. + * @return the form of this configuration form. + */ public Component getForm() { return this; } + /** + * Handles the ActionEvent triggered when user clicks on + * on the buttons. Shows the account registration wizard when user + * clicks on "New". + */ public void actionPerformed(ActionEvent e) { JButton sourceButton = (JButton)e.getSource();