account registration wizard enhancements

cusax-fix
Yana Stamcheva 20 years ago
parent 71e2fc8eb9
commit 6f2b5bf96e

@ -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() {

@ -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 <tt>AccountRegSummaryPage</tt>.
*
* @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 <code>WizardPage.getIdentifier</code> method.
* @return the page identifier, which in this case is the
* SUMMARY_PAGE_IDENTIFIER
*/
public Object getIdentifier() {
return WizardPage.SUMMARY_PAGE_IDENTIFIER;
}
/**
* Implements the <code>WizardPage.getNextPageIdentifier</code> 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 <code>WizardPage.getBackPageIdentifier</code> method.
* @return the previous page
*/
public Object getBackPageIdentifier() {
return WizardPage.DEFAULT_PAGE_IDENTIFIER;
return getPreviousPageIdentifier();
}
/**
* Implements the <code>WizardPage.getWizardForm</code> 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 <tt>WizardPage.pageNext</tt> 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;
}
}

@ -19,6 +19,7 @@
import net.java.sip.communicator.util.Logger;
/**
* The implementation of the <tt>AccountRegistrationWizardContainer</tt>.
*
* @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;
}
}

@ -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 <tt>AccountsConfigurationForm</tt> 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 <tt>AccountsConfigurationForm</tt>.
*
* @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 <tt>ActionEvent</tt> 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();

Loading…
Cancel
Save