Changeset 11992


Ignore:
Timestamp:
2006-07-04T09:29:53+12:00 (18 years ago)
Author:
shaoqun
Message:

add windowFocusListener to the main frame, so it saves the Configuration file when losing the focus

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/gli/src/org/greenstone/gatherer/gui/GUIManager.java

    r11629 r11992  
    6767public class GUIManager
    6868    extends JFrame
    69     implements ActionListener, ChangeListener {
     69    implements ActionListener, ChangeListener,  WindowFocusListener{
    7070    /** The download pane contains controls for downloading internet sites. */
    7171    public DownloadPane download_pane = null;
     
    8080
    8181    public FileOpenActionListener foa_listener = new FileOpenActionListener();
     82
    8283
    8384    /** A reference to the currently instantiated help window, if any. */
     
    100101
    101102
     103
     104
     105
     106  final static String newline = "\n";
     107    final static String space = "    ";
     108   
     109
    102110    /**Constructor. Enable window events and arranges all other components.
    103111     * @param size The intial <strong>Dimension</strong> of the screen.
     
    114122    this.addFocusListener(new GLIGUIFocusListener());
    115123
     124    this.addWindowFocusListener(this);
     125     
    116126    // Make the Tool tip hang around for a rediculous amount of time.
    117127    ToolTipManager.sharedInstance().setDismissDelay(10000);
     
    123133    }
    124134
     135 
     136
     137         public void windowGainedFocus(WindowEvent e) {
     138         //System.out.println("JPanel windowGainedFocus.");
     139    }
     140
     141    public void windowLostFocus(WindowEvent e) {
     142        //System.out.println("JPanel windowLostFocus.");
     143
     144    Gatherer.g_man.design_pane.saveConfiguration();
     145   
     146    }
     147 
     148
    125149    private class GLIGUIFocusListener
    126150    extends FocusAdapter {
    127151    public void focusGained(FocusEvent e) {
    128         if (ModalDialog.current_modal != null) {
     152            if (ModalDialog.current_modal != null) {
    129153        ModalDialog.current_modal.makeVisible();
    130154        ModalDialog.current_modal.toFront();
     
    269293    {
    270294    tab_pane.setSelectedComponent(gather_pane);
    271     Gatherer.c_man.saveCollection();
     295    Gatherer.c_man.saveCollection();
    272296    Gatherer.c_man.closeCollection();
    273297    }
Note: See TracChangeset for help on using the changeset viewer.