Changeset 10387


Ignore:
Timestamp:
2005-08-02T10:01:40+12:00 (19 years ago)
Author:
mdewsnip
Message:

Tidied up the way collections are saved and closed, and added some stuff in preparation for uploading metadata files to the server.

Location:
trunk/gli/src/org/greenstone/gatherer
Files:
4 edited

Legend:

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

    r10372 r10387  
    468468     * @see org.greenstone.gatherer.gui.GUIManager
    469469     */
    470     public void exit() {
     470    public void exit()
     471    {
    471472    exit = true;
    472     // If we have an open collection make note of it.
    473     Configuration.setString("general.open_collection", true, null);
    474     if(c_man.ready()) {
    475         ///ystem.err.println("Collection open.");
    476         if(c_man.saved()) {
    477         ///ystem.err.println("Collection has been recently saved, so I'll remember it for next time.");
    478         Configuration.setString("general.open_collection", true, c_man.getCollectionFilePath());
    479         }
    480         c_man.closeCollection();
    481     }
    482     if(assoc_man != null) {
     473
     474    // If we have an open collection remember it for next time, then save it and close it
     475    if (c_man.ready()) {
     476        Configuration.setString("general.open_collection", true, c_man.getCollectionFilePath());
     477        g_man.saveThenCloseCurrentCollection();
     478    }
     479    else {
     480        Configuration.setString("general.open_collection", true, null);
     481    }
     482
     483    // Save the file associations
     484    if (assoc_man != null) {
    483485        assoc_man.save();
    484486        assoc_man = null;
  • trunk/gli/src/org/greenstone/gatherer/gui/EnrichPane.java

    r10325 r10387  
    194194    // Force all of the controls to be updated
    195195    valueChanged(null);
     196    }
     197
     198
     199    /** Called to inform this pane that it has just lost focus as an effect of the user clicking on another tab
     200     */
     201    public void loseFocus()
     202    {
     203    // Nothing to do
    196204    }
    197205
  • trunk/gli/src/org/greenstone/gatherer/gui/GUIManager.java

    r10379 r10387  
    150150    }
    151151    else if (esrc == menu_bar.file_close) {
    152         tab_pane.setSelectedComponent(gather_pane);  // Must be done before closing the collection
    153         Gatherer.c_man.saveCollection();
    154         Gatherer.c_man.closeCollection();
     152        saveThenCloseCurrentCollection();
    155153    }
    156154    else if (esrc == menu_bar.file_delete) {
    157155        DeleteCollectionPrompt dcp = new DeleteCollectionPrompt();
    158156        if (dcp.display()) {
    159         Gatherer.c_man.closeCollection();
     157        saveThenCloseCurrentCollection();
    160158        }
    161159        dcp.destroy();
     
    176174    }
    177175    else if (esrc == menu_bar.file_exit) {
     176        returnToInitialPane();
    178177        exit();
    179178    }
     
    188187        // If there is already a collection open, save and close it
    189188        if (Gatherer.c_man.ready()) {
    190             tab_pane.setSelectedComponent(gather_pane);  // Must be done before closing the collection
    191             Gatherer.c_man.saveCollection();
    192             Gatherer.c_man.closeCollection();
     189            saveThenCloseCurrentCollection();
    193190        }
    194191
     
    286283
    287284
    288     public void closeCurrentCollection() {
     285    public void saveThenCloseCurrentCollection()
     286    {
     287    tab_pane.setSelectedComponent(gather_pane);
    289288    Gatherer.c_man.saveCollection();
    290289    Gatherer.c_man.closeCollection();
    291     tab_pane.setSelectedComponent(gather_pane);
    292290    }
    293291
     
    690688        // If there is already a collection open, save and close it.
    691689        if (Gatherer.c_man.ready()) {
    692         Gatherer.c_man.saveCollection();
    693         Gatherer.c_man.closeCollection();
     690        saveThenCloseCurrentCollection();
    694691        }
    695692
     
    745742     * @param event A ChangeEvent containing information about the event that fired this call.
    746743     */
    747     public void stateChanged(ChangeEvent event) {
    748     if(previous_pane != null) {
    749         if(previous_pane == create_pane) {
     744    public void stateChanged(ChangeEvent event)
     745    {
     746    // Tell the previous pane that it has lost focus
     747    if (previous_pane != null) {
     748        if (previous_pane == enrich_pane) {
     749        enrich_pane.loseFocus();
     750        }
     751        else if (previous_pane == design_pane) {
     752        design_pane.loseFocus();
     753        }
     754        else if (previous_pane == create_pane) {
    750755        create_pane.loseFocus();
    751         }
    752         else if(previous_pane == design_pane) {
    753            design_pane.loseFocus();
    754756        }
    755757    }
  • trunk/gli/src/org/greenstone/gatherer/gui/Preferences.java

    r10006 r10387  
    718718        // shut down the collection
    719719        System.err.println("shutting down teh collection");
    720         Gatherer.g_man.closeCurrentCollection();
     720        Gatherer.g_man.saveThenCloseCurrentCollection();
    721721        }
    722722
Note: See TracChangeset for help on using the changeset viewer.