diff options
author | Yana Stamcheva <yana@jitsi.org> | 2011-10-10 10:59:47 +0000 |
---|---|---|
committer | Yana Stamcheva <yana@jitsi.org> | 2011-10-10 10:59:47 +0000 |
commit | f654362d1cc34c8d290bffb4c283f5bd70c0db80 (patch) | |
tree | d4ca24194f3caa91dbb9cd2d613fbd0e48a5de5c /src/net/java/sip/communicator/plugin/sipaccregwizz | |
parent | cfff75a148b33c1a2c95580521f01102e11a16e8 (diff) | |
download | jitsi-f654362d1cc34c8d290bffb4c283f5bd70c0db80.zip jitsi-f654362d1cc34c8d290bffb4c283f5bd70c0db80.tar.gz jitsi-f654362d1cc34c8d290bffb4c283f5bd70c0db80.tar.bz2 |
Extends account wizard class with forgot password link.
Diffstat (limited to 'src/net/java/sip/communicator/plugin/sipaccregwizz')
-rw-r--r-- | src/net/java/sip/communicator/plugin/sipaccregwizz/AccountPanel.java | 52 | ||||
-rw-r--r-- | src/net/java/sip/communicator/plugin/sipaccregwizz/SIPAccountRegistrationForm.java | 20 |
2 files changed, 68 insertions, 4 deletions
diff --git a/src/net/java/sip/communicator/plugin/sipaccregwizz/AccountPanel.java b/src/net/java/sip/communicator/plugin/sipaccregwizz/AccountPanel.java index 9e2604f..0ae424a 100644 --- a/src/net/java/sip/communicator/plugin/sipaccregwizz/AccountPanel.java +++ b/src/net/java/sip/communicator/plugin/sipaccregwizz/AccountPanel.java @@ -116,10 +116,16 @@ public class AccountPanel southPanel.add(rememberPassBox); - String webSignup = regform.getWebSignupLinkName(); - if (webSignup != null) + String webSignupLinkText = regform.getWebSignupLinkName(); + + if (webSignupLinkText != null && webSignupLinkText.length() > 0) + southPanel.add(createWebSignupLabel(webSignupLinkText)); + else { - southPanel.add(createSubscribeLabel(webSignup)); + String forgotPassLinkText = regform.getForgotPasswordLinkName(); + + if (forgotPassLinkText != null && forgotPassLinkText.length() > 0) + southPanel.add(createForgotPasswordLabel(forgotPassLinkText)); } uinPassPanel.setBorder(BorderFactory.createTitledBorder(Resources @@ -281,7 +287,7 @@ public class AccountPanel * @param linkName the link name * @return the newly created subscribe label */ - private Component createSubscribeLabel(String linkName) + private Component createWebSignupLabel(String linkName) { JLabel subscribeLabel = new JLabel("<html><a href=''>" @@ -314,6 +320,44 @@ public class AccountPanel } /** + * Creates the subscribe label. + * @param linkName the link name + * @return the newly created subscribe label + */ + private Component createForgotPasswordLabel(String linkName) + { + JLabel subscribeLabel = + new JLabel("<html><a href=''>" + + linkName + + "</a></html>", + JLabel.RIGHT); + + subscribeLabel.setCursor(new Cursor(Cursor.HAND_CURSOR)); + subscribeLabel.setToolTipText( + Resources.getString("plugin.simpleaccregwizz.FORGOT_PASSWORD")); + subscribeLabel.addMouseListener(new MouseAdapter() + { + public void mousePressed(MouseEvent e) + { + try + { + SIPAccRegWizzActivator.getBrowserLauncher() + .openURL(regform.getForgotPasswordLink()); + } + catch (UnsupportedOperationException ex) + { + // This should not happen, because we check if the + // operation is supported, before adding the sign + // up. + logger.error("The web sign up is not supported.", + ex); + } + } + }); + return subscribeLabel; + } + + /** * Creates a register choice panel. * @return the created component */ diff --git a/src/net/java/sip/communicator/plugin/sipaccregwizz/SIPAccountRegistrationForm.java b/src/net/java/sip/communicator/plugin/sipaccregwizz/SIPAccountRegistrationForm.java index 743740f..f3fbd57 100644 --- a/src/net/java/sip/communicator/plugin/sipaccregwizz/SIPAccountRegistrationForm.java +++ b/src/net/java/sip/communicator/plugin/sipaccregwizz/SIPAccountRegistrationForm.java @@ -492,6 +492,26 @@ public class SIPAccountRegistrationForm } /** + * Returns the forgot password link name. + * + * @return the forgot password link name + */ + public String getForgotPasswordLinkName() + { + return wizard.getForgotPasswordLinkName(); + } + + /** + * Returns the forgot password link. + * + * @return the forgot password link + */ + public String getForgotPasswordLink() + { + return wizard.getForgotPasswordLink(); + } + + /** * Returns an instance of <tt>CreateAccountService</tt> through which the * user could create an account. This method is meant to be implemented by * specific protocol provider wizards. |