001    /** =====================================================================       
002    *
003    *  File Name : $Id: UpdateFaultSubscriptionListener.java,v 1.1 2007/10/08 09:33:35 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: UpdateFaultSubscriptionListener.java,v 1.1 2007/10/08 09:33:35 cb Exp $
030    *
031    *     @author    : $Author: cb $
032    *
033    *     Header     : $Header: /opt/INGsrc/src/CVS/softproj/FaultDatabase/src/FaultDatabase/FaultDatabase/src/GWTApplication/client/UpdateFaultSubscriptionListener.java,v 1.1 2007/10/08 09:33:35 cb Exp $
034    *
035    *     Log        : $Log: UpdateFaultSubscriptionListener.java,v $
036    *     Log        : Revision 1.1  2007/10/08 09:33:35  cb
037    *     Log        : First version
038    *     Log        :
039    *     Log        : Revision 1.2  2007/08/17 14:22:43  cb
040    *     Log        : After PMD session
041    *     Log        :
042    *     Log        : Revision 1.1  2007/07/24 08:25:23  cb
043    *     Log        : First version
044    *     Log        :
045    *
046    * =====================================================================*/
047    
048    package GWTApplication.client;
049    
050    import com.google.gwt.core.client.GWT;
051    import com.google.gwt.user.client.*;
052    import com.google.gwt.user.client.rpc.*;
053    import com.google.gwt.user.client.ui.*;
054    import com.google.gwt.i18n.client.*;
055    
056    import java.util.*;
057    
058    /**
059     * This class is a listener class which is called when the user clicks
060     * upon the <b>Update </B> link at the top of the main display and
061     * results in a dialog window being displayed in which the user can modify the list of faults which he is subscribed to 
062     * @version $Id: UpdateFaultSubscriptionListener.java,v 1.1 2007/10/08 09:33:35 cb Exp $
063     * @author Craige Bevil 
064     */
065    
066    class UpdateFaultSubscriptionListener implements ClickListener {
067    
068        /**
069         * This is the dialog window in which the user will change the list of faults which he has subscribed to 
070         */
071        
072        private ModifyFaultSubscriptionListDialog modifyFaultSubscriptionListDialog;
073        
074        /**
075         * The authentication details of the user 
076         */
077        
078        private AuthenticationDetails UserAuthentication;
079        
080        /** 
081         * This is the service which will be used to access the servlet
082         * which is running in the tomcat container
083         */
084    
085        final private FaultServiceAsync svc;
086        
087        /**
088         * Constructor 
089         * @param UserAuthentication This is the details of the users
090         * authentication. 
091         */
092        
093        UpdateFaultSubscriptionListener (final AuthenticationDetails UserAuthentication) {
094    
095            // Now test out the object which will be used to communicate
096            // with the servlet on the tomcat server
097            
098            this.UserAuthentication = UserAuthentication;
099            
100            svc = (FaultServiceAsync) GWT.create(FaultService.class);
101    
102            final ServiceDefTarget endPoint = (ServiceDefTarget) svc;
103    
104            endPoint.setServiceEntryPoint(GWT.getModuleBaseURL() + "/faultService");
105        }
106        
107        /**
108         * This is called when the user clicks on the hyperlink which
109         * allows the user to update his list of subscribed faults. It results in a 
110         * dialog box being 
111         * displayed (see {@link ModifyFaultSubscriptionListDialog
112         * ModifyFaultSubscriptionListDialog}).
113         * @param sender This is the widget that raised this event. 
114         */
115        
116        public void onClick (final Widget sender) {
117    
118            // Now display the dialog in which the user can change his
119            // list of faults.
120    
121            ModifyFaultSubscriptionListDialog modifyFaultSubscriptionListDialog = new ModifyFaultSubscriptionListDialog(svc,UserAuthentication);
122            
123            modifyFaultSubscriptionListDialog.showChangeFaultsSubscribedToDialog();
124        }
125    }