If you are looking for Jitsi Meet, the WebRTC compatible video conferencing product click here.

previous | TOC

UI Service Documentation

Create account registration wizard

An account registration wizard is a wizard which will guide the user through a protocol account registration. For different protocols the process of creating an account is different - although that the username and password are always present, there are additional configurations specific for each protocol. For this reason an account registration wizard should be created for a specific protocol and added to the UI like a plugin.

How to create an account registration wizard

To create an account registration wizard you need to implement two interfaces - the AccountRegistrationWizard and the WizardPage interface.

The AccountRegistrationWizard interface is meant to provide a set of pages, an icon, the name and the description of the corresponding protocol. Each of the pages provided by the wizard should implement the WizardPage interface.

Note that the AccountRegistrationWizard is NOT a real wizard, it doesn’t handle wizard events. It’s the UI Service implementation that provide its own wizard ui control, which should manage all the events, panels, buttons, etc.

If you want to implement the UIService: Implement the AccountRegistrationWizard Container interface to provide a mechanism for adding and removing account registration wizards in the GUI. Example: Look at the swing implementation of the UIService.

AccountRegistrationWizard interface

* getIcon - you should return here the icon that will appear on the left of your wizard.
* getProtocolName - you should return here the protocol name, which will help the user to choose the right wizard when registering an account.
* getProtocolDescription - you should return here a short description, which will help the user to choose the right wizard when registering an account.
* loadAccount(ProtocolProviderService protocolProvider) - this method will be invoked from the UI when a modification of an already existing account is needed. Thus in this method you should fill all fields concerning the registration of the given protocol provider.
* getPages - you should return here the set of WizardPages containing in your wizard.
* getSummary - if the current UI implementation supports a summary page, this is the method which should return a set of key-value pairs for this page.
* finish - this method will be executed when the user clicks on the wizard “Finish” button. You should put here all the stuff that need to be executed at the end of the wizard.

WizardPage interface

* getIdentifier - each WizardPage should have a unique Object identifier. There are three predefined identifiers: FINISH_PAGE_IDENTIFIER, SUMMARY_PAGE_IDENTIFIER and DEFAULT_PAGE_IDENTIFIER. Do not use them as identifiers for your pages, car they are reserved for the UI implementation.
* getNextPageIdentifier - you should return here the identifier of the page that should be displayed when user clicks on the “Next” wizard button.
* getBackPageIdentifier - you should return here the identifier of the page that should be displayed when user clicks on the “Back” wizard button.
* getWizardForm - return here the user interface form represented by this page. Note that the form should be developed by using a library that is supported from current UI Service implementation.
* pageHiding - invoked just before this WizardPage is hidden, eighter because the user has clicked “Back” or “Next”.
* pageShowing - invoked just before this WizardPage is shown, eighter because the user has clicked “Back” on the next wizard page or “Next” on the previous one.
* pageShown - invoked when this WizardPage is shown to the user.
* pageNext - invoked when user clicks on the “Next” wizard button.
* pageBack - Invoked when user clicks on the “Back” wizard button.

How to add the account registration wizard in the UI

Once created, your AccountRegistrationWizard should be added to the UI. In the UIService interface you have a method called: getAccountRegWizardContainer. This method will return you the AccountRegistrationWizardContainer interface, which is implemented by the UI implementation and is charged to manage all account registration wizards. You could add then your wizard by invoking: addAccountRegistrationWizard.

Example: An implementation of the AccountRegistrationWizard for the ICQ protocol.

public class IcqAccountRegistrationWizard implements AccountRegistrationWizard {
...
    /**
     * Returns the set of pages contained in this wizard.
     */

    public Iterator getPages() {
        ArrayList pages = new ArrayList();
        firstWizardPage = new FirstWizardPage(registration, wizardContainer);

        pages.add(firstWizardPage);

        return pages.iterator();
    }

    /**
     * Returns a set of the data that user has entered through this wizard.
     */

    public Iterator getSummary() {
        Hashtable summaryTable = new Hashtable();

        summaryTable.put("UIN", registration.getUin());
        summaryTable.put("Remember password",
                new Boolean(registration.isRememberPassword()));

        return summaryTable.entrySet().iterator();
    }

    /**
     * Installs the account created through this wizard.
     */

    public ProtocolProviderService finish() {
        firstWizardPage = null;
        ProtocolProviderFactory factory
            = IcqAccRegWizzActivator.getIcqProtocolProviderFactory();

        return this.installAccount(factory,
                registration.getUin(), registration.getPassword());
    }
...
}

public class FirstWizardPage extends JPanel
    implements WizardPage {

    /**
     * Implements the <code>WizardPage.getIdentifier</code> to return
     * this page identifier.
     */

    public Object getIdentifier() {
        return FIRST_PAGE_IDENTIFIER;
    }

    /**
     * Implements the <code>WizardPage.getNextPageIdentifier</code> to return
     * the next page identifier - the summary page.
     */

    public Object getNextPageIdentifier() {
        return WizardPage.SUMMARY_PAGE_IDENTIFIER;
    }

    /**
     * Implements the <code>WizardPage.getBackPageIdentifier</code> to return
     * the next back identifier - the default page.
     */

    public Object getBackPageIdentifier() {
        return WizardPage.DEFAULT_PAGE_IDENTIFIER;
    }

    /**
     * Implements the <code>WizardPage.getWizardForm</code> to return
     * this panel.
     */

    public Object getWizardForm() {
        return this;
    }

    /**
     * Before this page is displayed enables or disables the "Next" wizard
     * button according to whether the UIN field is empty.
     */

    public void pageShowing() {
        this.setNextButtonAccordingToUIN();
    }

    /**
     * Saves the user input when the "Next" wizard buttons is clicked.
     */

    public void pageNext() {
        registration.setUin(uinField.getText());
        registration.setPassword(new String(passField.getPassword()));
        registration.setRememberPassword(rememberPassBox.isSelected());
    }

....
}

You could find the source code of this example in the plugin.icqaccregwizz package.

author: Yana Stamcheva

previous | TOC