aboutsummaryrefslogtreecommitdiffstats
path: root/src/net/java/sip/communicator/service/gui
diff options
context:
space:
mode:
authorYana Stamcheva <yana@jitsi.org>2011-06-07 09:04:06 +0000
committerYana Stamcheva <yana@jitsi.org>2011-06-07 09:04:06 +0000
commitff20df76ebdf84b8f0f93e16674ed3c069edc5f6 (patch)
treee51dea7f4217e2f8bb415ba5c53695aeefe7fccd /src/net/java/sip/communicator/service/gui
parent87b95d7fb381d336e08b67e06d87efb8aeb15e37 (diff)
downloadjitsi-ff20df76ebdf84b8f0f93e16674ed3c069edc5f6.zip
jitsi-ff20df76ebdf84b8f0f93e16674ed3c069edc5f6.tar.gz
jitsi-ff20df76ebdf84b8f0f93e16674ed3c069edc5f6.tar.bz2
Pre-selects the protocol provider corresponding to the default protocol in the add contact dialog.
Diffstat (limited to 'src/net/java/sip/communicator/service/gui')
-rw-r--r--src/net/java/sip/communicator/service/gui/AccountRegistrationWizard.java118
-rw-r--r--src/net/java/sip/communicator/service/gui/ExtendedAccountRegistrationWizard.java6
-rw-r--r--src/net/java/sip/communicator/service/gui/gui.manifest.mf3
-rw-r--r--src/net/java/sip/communicator/service/gui/internal/GuiServiceActivator.java29
4 files changed, 123 insertions, 33 deletions
diff --git a/src/net/java/sip/communicator/service/gui/AccountRegistrationWizard.java b/src/net/java/sip/communicator/service/gui/AccountRegistrationWizard.java
index c1bf3bc..c7bfa3e 100644
--- a/src/net/java/sip/communicator/service/gui/AccountRegistrationWizard.java
+++ b/src/net/java/sip/communicator/service/gui/AccountRegistrationWizard.java
@@ -9,6 +9,7 @@ package net.java.sip.communicator.service.gui;
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 @@ import net.java.sip.communicator.service.protocol.*;
*
* @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
- * will choose the protocol to register to.
+ * Returns the protocol display name that will be shown in the list,
+ * where user will 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 interface AccountRegistrationWizard
* 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 interface AccountRegistrationWizard
* <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 interface AccountRegistrationWizard
* @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 interface AccountRegistrationWizard
* @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 interface AccountRegistrationWizard
* @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 interface AccountRegistrationWizard
* @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 interface AccountRegistrationWizard
* @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;
+ }
}
diff --git a/src/net/java/sip/communicator/service/gui/ExtendedAccountRegistrationWizard.java b/src/net/java/sip/communicator/service/gui/ExtendedAccountRegistrationWizard.java
index 162f791..a32094a 100644
--- a/src/net/java/sip/communicator/service/gui/ExtendedAccountRegistrationWizard.java
+++ b/src/net/java/sip/communicator/service/gui/ExtendedAccountRegistrationWizard.java
@@ -11,7 +11,7 @@ package net.java.sip.communicator.service.gui;
*
* @author Yana Stamcheva
*/
-public interface ExtendedAccountRegistrationWizard
+public abstract class ExtendedAccountRegistrationWizard
extends AccountRegistrationWizard
{
/**
@@ -20,10 +20,10 @@ public interface ExtendedAccountRegistrationWizard
* @return <tt>true</tt> if a sign up form is supported by this wizard,
* <tt>false</tt> - otherwise
*/
- public boolean isSignupSupported();
+ public abstract boolean isSignupSupported();
/**
* Sets the create account view of this registration wizard.
*/
- public void setCreateAccountView();
+ public abstract void setCreateAccountView();
}
diff --git a/src/net/java/sip/communicator/service/gui/gui.manifest.mf b/src/net/java/sip/communicator/service/gui/gui.manifest.mf
index c33ba57..e35b3ec 100644
--- a/src/net/java/sip/communicator/service/gui/gui.manifest.mf
+++ b/src/net/java/sip/communicator/service/gui/gui.manifest.mf
@@ -5,7 +5,8 @@ Bundle-Vendor: sip-communicator.org
Bundle-Version: 0.0.1
System-Bundle: yes
Import-Package: org.osgi.framework,
- net.java.sip.communicator.service.resources
+ net.java.sip.communicator.service.resources,
+ net.java.sip.communicator.util
Export-Package: net.java.sip.communicator.service.gui,
net.java.sip.communicator.service.gui.event,
net.java.sip.communicator.service.shutdown
diff --git a/src/net/java/sip/communicator/service/gui/internal/GuiServiceActivator.java b/src/net/java/sip/communicator/service/gui/internal/GuiServiceActivator.java
index 008d523..dc07df5 100644
--- a/src/net/java/sip/communicator/service/gui/internal/GuiServiceActivator.java
+++ b/src/net/java/sip/communicator/service/gui/internal/GuiServiceActivator.java
@@ -5,10 +5,14 @@
*/
package net.java.sip.communicator.service.gui.internal;
+import net.java.sip.communicator.service.resources.*;
+import net.java.sip.communicator.util.*;
+
import org.osgi.framework.*;
/**
* @author Lubomir Marinov
+ * @author Yana Stamcheva
*/
public class GuiServiceActivator
implements BundleActivator
@@ -19,6 +23,12 @@ public class GuiServiceActivator
private static BundleContext bundleContext;
/**
+ * The <tt>ResourceManagementService</tt>, which gives access to application
+ * resources.
+ */
+ private static ResourceManagementService resourceService;
+
+ /**
* Returns the <tt>BundleContext</tt>.
*
* @return bundle context
@@ -48,4 +58,23 @@ public class GuiServiceActivator
if (GuiServiceActivator.bundleContext == bundleContext)
GuiServiceActivator.bundleContext = null;
}
+
+ /**
+ * Returns the <tt>ResourceManagementService</tt>, through which we will
+ * access all resources.
+ *
+ * @return the <tt>ResourceManagementService</tt>, through which we will
+ * access all resources.
+ */
+ public static ResourceManagementService getResources()
+ {
+ if (resourceService == null)
+ {
+ resourceService
+ = ServiceUtils.getService(
+ bundleContext,
+ ResourceManagementService.class);
+ }
+ return resourceService;
+ }
}