001    /** =====================================================================       
002    *
003    *  File Name : $Id: ChangePasswordListener.java,v 1.2 2007/08/17 14:22:43 cb Exp $
004    *
005    *  Description
006    *  -----------
007    *
008    *  =====================================================================
009    *
010    *   @author : Craige Bevil 
011    *             Control Software Group
012    *             Isaac Newton Group of Telescopes
013    *
014    *  =====================================================================
015    *
016    *     Modification Log
017    *
018    *     Vers         Date        Author       Reason
019    *     ----         ----        ------       ------
020    *      1                       C.Bevil      First Release
021    *
022    *     Commissioning Notes
023    *     -------------------
024    *
025    *     None
026    *     
027    *  =====================================================================
028    *
029    *     @version   : $Id: ChangePasswordListener.java,v 1.2 2007/08/17 14:22:43 cb Exp $
030    *
031    *     @author    : $Author: cb $
032    *
033    *     Header     : $Header: /opt/INGsrc/src/CVS/softproj/FaultDatabase/src/FaultDatabase/FaultDatabase/src/GWTApplication/client/ChangePasswordListener.java,v 1.2 2007/08/17 14:22:43 cb Exp $
034    *
035    *     Log        : $Log: ChangePasswordListener.java,v $
036    *     Log        : Revision 1.2  2007/08/17 14:22:43  cb
037    *     Log        : After PMD session
038    *     Log        :
039    *     Log        : Revision 1.1  2007/07/24 08:25:23  cb
040    *     Log        : First version
041    *     Log        :
042    *
043    * =====================================================================*/
044    
045    package GWTApplication.client;
046    
047    import com.google.gwt.core.client.GWT;
048    import com.google.gwt.user.client.*;
049    import com.google.gwt.user.client.rpc.*;
050    import com.google.gwt.user.client.ui.*;
051    import com.google.gwt.i18n.client.*;
052    
053    import java.util.*;
054    
055    /**
056     * This class is a listener class which is called when the user clicks
057     * upon the <b>Change Password</B> link at the top of the display and
058     * results in a dialog window being displayed in which the user can
059     * enter the details of a new password.
060     * @version $Id: ChangePasswordListener.java,v 1.2 2007/08/17 14:22:43 cb Exp $
061     * @author Craige Bevil 
062     */
063    
064    class ChangePasswordListener implements ClickListener {
065    
066        /**
067         * This is the dialog window in which the user will change his
068         * password
069         */
070        
071        private ChangePasswordDialogBox changePasswordDialog;
072        
073        /**
074         * The authentication details of the user 
075         */
076        
077        private AuthenticationDetails UserAuthentication;
078        
079        /** 
080         * This is the service which will be used to access the servlet
081         * which is running in the tomcat container
082         */
083    
084        final private FaultServiceAsync svc;
085        
086        /**
087         * Constructor 
088         * @param UserAuthentication This is the details of the users
089         * authentication. 
090         */
091        
092        ChangePasswordListener (final AuthenticationDetails UserAuthentication) {
093    
094            // Now test out the object which will be used to communicate
095            // with the servlet on the tomcat server
096            
097            this.UserAuthentication = UserAuthentication;
098            
099            svc = (FaultServiceAsync) GWT.create(FaultService.class);
100    
101            final ServiceDefTarget endPoint = (ServiceDefTarget) svc;
102    
103            endPoint.setServiceEntryPoint(GWT.getModuleBaseURL() + "/faultService");
104        }
105        
106        /**
107         * This is called when the user clicks on the hyperlink which
108         * allows the user to change his password. It results in the the
109         * dialog box which is used to change the password being
110         * displayed (see {@link ChangePasswordDialogBox
111         * ChangePasswordDialogBox}).
112         * @param sender This is the widget that raised this event. 
113         */
114        
115        public void onClick (final Widget sender) {
116    
117            // Now display the dialog in which the user can change the
118            // password
119    
120            ChangePasswordDialogBox changePasswordDialog = new ChangePasswordDialogBox(svc,UserAuthentication.UserEmailAddress);
121            
122            changePasswordDialog.showChangePasswordDialog();
123        }
124    }