@ -9,6 +9,7 @@
import java.awt.* ;
import java.util.* ;
import net.java.sip.communicator.service.gui.internal.* ;
import net.java.sip.communicator.service.protocol.* ;
/ * *
@ -28,29 +29,36 @@
*
* @author Yana Stamcheva
* /
public interface AccountRegistrationWizard
public abstract class AccountRegistrationWizard
{
/ * *
* Is current wizard run as modification of an existing account .
* /
private boolean isModification ;
private WizardContainer wizardContainer ;
/ * *
* Returns the protocol icon that will be shown on the left of the protocol
* name in the list , where user will choose the protocol to register to .
*
* @return a short description of the protocol .
* /
public byte [ ] getIcon ( ) ;
public abstract byte [ ] getIcon ( ) ;
/ * *
* Returns the image that will be shown on the left of the wizard pages .
* @return the image that will be shown on the left of the wizard pages
* /
public byte [ ] getPageImage ( ) ;
public abstract byte [ ] getPageImage ( ) ;
/ * *
* Returns the protocol name that will be shown in the list , where user
* w ill choose the protocol to register to .
* Returns the protocol display name that will be shown in the list ,
* w here user w ill choose the protocol to register to .
*
* @return the protocol name .
* /
public String getProtocolName ( ) ;
public abstract String getProtocolName ( ) ;
/ * *
* Returns a short description of the protocol that will be shown on the
@ -59,7 +67,7 @@ public interface AccountRegistrationWizard
*
* @return a short description of the protocol .
* /
public String getProtocolDescription ( ) ;
public abstract String getProtocolDescription ( ) ;
/ * *
* Returns an example string , which should indicate to the user how the
@ -67,7 +75,7 @@ public interface AccountRegistrationWizard
* @return an example string , which should indicate to the user how the
* user name should look like .
* /
public String getUserNameExample ( ) ;
public abstract String getUserNameExample ( ) ;
/ * *
* Loads all data concerning the given < tt > ProtocolProviderService < / tt > .
@ -77,7 +85,7 @@ public interface AccountRegistrationWizard
* @param protocolProvider The < tt > ProtocolProviderService < / tt > to
* load data from .
* /
public void loadAccount ( ProtocolProviderService protocolProvider ) ;
public abstract void loadAccount ( ProtocolProviderService protocolProvider ) ;
/ * *
* Returns the set of < tt > WizardPage < / tt > - s for this
@ -86,7 +94,7 @@ public interface AccountRegistrationWizard
* @return the set of < tt > WizardPage < / tt > - s for this
* wizard .
* /
public Iterator < WizardPage > getPages ( ) ;
public abstract Iterator < WizardPage > getPages ( ) ;
/ * *
* Returns the identifier of the first account registration wizard page .
@ -95,7 +103,7 @@ public interface AccountRegistrationWizard
*
* @return the identifier of the first account registration wizard page
* /
public Object getFirstPageIdentifier ( ) ;
public abstract Object getFirstPageIdentifier ( ) ;
/ * *
* Returns the identifier of the last account registration wizard page . This
@ -104,7 +112,7 @@ public interface AccountRegistrationWizard
*
* @return the identifier of the last account registration wizard page
* /
public Object getLastPageIdentifier ( ) ;
public abstract Object getLastPageIdentifier ( ) ;
/ * *
* Returns a set of key - value pairs that will represent the summary for
@ -113,7 +121,7 @@ public interface AccountRegistrationWizard
* @return a set of key - value pairs that will represent the summary for
* this wizard .
* /
public Iterator < Map . Entry < String , String > > getSummary ( ) ;
public abstract Iterator < Map . Entry < String , String > > getSummary ( ) ;
/ * *
* Defines the operations that will be executed when the user clicks on
@ -122,7 +130,7 @@ public interface AccountRegistrationWizard
* new account
* @throws OperationFailedException if the operation didn ' t succeed
* /
public ProtocolProviderService signin ( )
public abstract ProtocolProviderService signin ( )
throws OperationFailedException ;
/ * *
@ -135,7 +143,7 @@ public ProtocolProviderService signin()
* new account
* @throws OperationFailedException if the operation didn ' t succeed
* /
public ProtocolProviderService signin ( String userName ,
public abstract ProtocolProviderService signin ( String userName ,
String password )
throws OperationFailedException ;
@ -144,7 +152,7 @@ public ProtocolProviderService signin( String userName,
* < tt > protocolProvider < / tt > has been removed .
* @param protocolProvider the protocol provider that has been removed
* /
public void accountRemoved ( ProtocolProviderService protocolProvider ) ;
public void accountRemoved ( ProtocolProviderService protocolProvider ) { }
/ * *
* Returns < code > true < / code > if the web sign up is supported by the current
@ -152,7 +160,10 @@ public ProtocolProviderService signin( String userName,
* @return < code > true < / code > if the web sign up is supported by the current
* implementation , < code > false < / code > - otherwise
* /
public boolean isWebSignupSupported ( ) ;
public boolean isWebSignupSupported ( )
{
return false ;
}
/ * *
* Defines the operation that will be executed when user clicks on the
@ -161,14 +172,25 @@ public ProtocolProviderService signin( String userName,
* @throws UnsupportedOperationException if the web sign up operation is
* not supported by the current implementation .
* /
public void webSignup ( ) throws UnsupportedOperationException ;
public void webSignup ( ) throws UnsupportedOperationException { }
/ * *
* Returns the preferred dimensions of this wizard .
*
* @return the preferred dimensions of this wizard .
* /
public Dimension getSize ( ) ;
public abstract Dimension getSize ( ) ;
/ * *
* 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 .
*
* @param isCreateAccount indicates if the simple form should be opened as
* a create account form or as a login form
* @return a simple account registration form
* /
public abstract Object getSimpleForm ( boolean isCreateAccount ) ;
/ * *
* Sets the modification property to indicate if this wizard is opened for
@ -177,7 +199,10 @@ public ProtocolProviderService signin( String userName,
* @param isModification indicates if this wizard is opened for modification
* or for creating a new account .
* /
public void setModification ( boolean isModification ) ;
public void setModification ( boolean isModification )
{
this . isModification = isModification ;
}
/ * *
* Indicates if this wizard is modifying an existing account or is creating
@ -186,7 +211,10 @@ public ProtocolProviderService signin( String userName,
* @return < code > true < / code > to indicate that this wizard is currently in
* modification mode , < code > false < / code > - otherwise .
* /
public boolean isModification ( ) ;
public boolean isModification ( )
{
return isModification ;
}
/ * *
* Indicates whether this wizard enables the simple "sign in" form shown
@ -197,16 +225,48 @@ public ProtocolProviderService signin( String userName,
* @return < code > true < / code > if the simple "Sign in" form is enabled or
* < code > false < / code > otherwise .
* /
public boolean isSimpleFormEnabled ( ) ;
public boolean isSimpleFormEnabled ( )
{
return true ;
}
/ * *
* 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 .
* Returns the wizard container , where all pages are added .
*
* @return the wizard container , where all pages are added
* /
public WizardContainer getWizardContainer ( )
{
return wizardContainer ;
}
/ * *
* Sets the wizard container , where all pages are added .
*
* @param wizardContainer the wizard container , where all pages are added
* /
protected void setWizardContainer ( WizardContainer wizardContainer )
{
this . wizardContainer = wizardContainer ;
}
/ * *
* Indicates if this wizard is for the preferred protocol .
*
* @param isCreateAccount indicates if the simple form should be opened as
* a create account form or as a login form
* @return a simple account registration form
* @return < tt > true < / tt > if this wizard corresponds to the preferred
* protocol , otherwise returns < tt > false < / tt >
* /
public Object getSimpleForm ( boolean isCreateAccount ) ;
public boolean isPreferredProtocol ( )
{
// Check for preferred account through the PREFERRED_ACCOUNT_WIZARD
// property.
String prefWName = GuiServiceActivator . getResources ( ) .
getSettingsString ( "impl.gui.PREFERRED_ACCOUNT_WIZARD" ) ;
if ( prefWName ! = null & & prefWName . length ( ) > 0
& & prefWName . equals ( this . getClass ( ) . getName ( ) ) )
return true ;
return false ;
}
}