001    /** =====================================================================       
002    *
003    *  File Name : $Id: QuickHelpDialog.java,v 1.1 2007/12/17 12:26:56 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: QuickHelpDialog.java,v 1.1 2007/12/17 12:26:56 cb Exp $
030    *
031    *     @author    : $Author: cb $
032    *
033    *     Header     : $Header: /opt/INGsrc/src/CVS/softproj/FaultDatabase/src/FaultDatabase/FaultDatabase/src/GWTApplication/client/QuickHelpDialog.java,v 1.1 2007/12/17 12:26:56 cb Exp $
034    *
035    *     Log        : $Log: QuickHelpDialog.java,v $
036    *     Log        : Revision 1.1  2007/12/17 12:26:56  cb
037    *     Log        : First version
038    *     Log        :
039    *     Log        : Revision 1.4  2007/10/19 08:51:57  cb
040    *     Log        : Updated so that the cookie storing the printer name does not expire at
041    *     Log        : the end of the browser session.
042    *     Log        :
043    *     Log        : Revision 1.3  2007/08/17 14:26:41  cb
044    *     Log        : Updated for lastest prototype incorporating a lot of Nikos comments
045    *     Log        :
046    *     Log        : Revision 1.2  2007/08/01 13:00:04  cb
047    *     Log        : First prototype after import
048    *     Log        :
049    *     Log        : Revision 1.1  2007/07/24 08:27:08  cb
050    *     Log        : First version
051    *     Log        :
052    *
053    * =====================================================================*/
054    
055    package GWTApplication.client;
056    
057    import com.google.gwt.user.client.*;
058    import com.google.gwt.user.client.rpc.*;
059    import com.google.gwt.user.client.ui.*;
060    import com.google.gwt.user.client.ui.DockPanel.*;
061    
062    import java.util.*;
063    
064    /**
065     * This class will be used to display quick help which is associated with the system. 
066     * @version $Id: QuickHelpDialog.java,v 1.1 2007/12/17 12:26:56 cb Exp $
067     * @author Craige Bevil 
068     */
069    
070    public class QuickHelpDialog extends FaultDBForm implements ClickListener {
071    
072        /**
073         * This the URL of the page which contains the help information
074         */
075        
076        private String helpURL;
077        
078        /**
079         * This is the frame which will hold the help information 
080         */
081        
082        private Frame helpFrame;
083        
084        /**
085         * This is the cancel button widget
086         */
087        
088        final private Button CancelButton;
089            
090        DialogBox HelpDialog = new DialogBox(false);   
091                        
092        /**
093         * Constructor
094         */
095        
096        QuickHelpDialog (final String helpURL) {
097            
098            this.helpURL = helpURL;
099    
100            DockPanel panel = new DockPanel();
101            
102            helpFrame = new Frame (helpURL);
103                
104            CancelButton = new Button(internationalizationConstants.cancel(),this);
105    
106            panel.add(helpFrame,DockPanel.NORTH);
107            panel.add(CancelButton,DockPanel.WEST);
108            panel.setSpacing(5);
109    
110            // Now add the main panel to the dialog box
111    
112            HelpDialog.setWidget(panel);
113    
114            HelpDialog.setText(internationalizationConstants.help());               
115        }   
116    
117    
118        /**
119         * This is the click handler which is called when the user calls
120         * presses one of the buttons on the print dialog. He can either
121         * press the print button or the cancel button.
122         * @param sender This is the widget which created the event. 
123         */
124        
125        public void onClick (Widget sender) {
126            
127            if (sender.equals(CancelButton)) {
128                HelpDialog.hide();
129            }
130        }
131        
132        /**
133         * Displays the new quick help dialog to the user 
134         */
135        
136        public void showHelpDialog () {
137            HelpDialog.show();              
138            HelpDialog.center();
139        }
140    }
141