Changeset 10587


Ignore:
Timestamp:
2005-08-31T12:47:34+12:00 (19 years ago)
Author:
mdewsnip
Message:

Merged showNewCollectionPrompt into NewCollectionTask, to make things easier for the West Yorkshire code.

File:
1 edited

Legend:

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

    r10559 r10587  
    178178    }
    179179        else if (esrc == menu_bar.file_new) {
    180         showNewCollectionPrompt();
     180        new NewCollectionTask().start();
    181181    }
    182182    else if (esrc == menu_bar.file_open) {
     
    705705    wait(false);
    706706    }
    707     /** This method is used to open the new collection box on the screen.
    708      */
    709     private void showNewCollectionPrompt() {
    710     NewCollectionMetadataPrompt ncm_prompt = null;
    711     // Create the collection details prompt from new collection prompt
    712     NewCollectionDetailsPrompt ncd_prompt = new NewCollectionDetailsPrompt();
    713     // If no previous collection was indicated as a model design, then show the metadata selection prompt from new collection prompt
    714     if(!ncd_prompt.isCancelled() && (ncd_prompt.getBase() == null)) {
    715         ncm_prompt = new NewCollectionMetadataPrompt();
    716     }
    717     // Create the new collection (if not cancelled) in a new thread.
    718     if (!ncd_prompt.isCancelled() && (ncm_prompt == null || !ncm_prompt.isCancelled())) {
    719         // If there is already a collection open, save and close it.
    720         if (Gatherer.c_man.ready()) {
    721         saveThenCloseCurrentCollection();
    722         }
    723 
    724         // Create new collection.
    725         NewCollectionTask new_collection_task = new NewCollectionTask(ncd_prompt, ncm_prompt);
    726         new_collection_task.start();
    727     }
    728     // Done
    729     ncd_prompt = null;
    730     ncm_prompt = null;
    731     }
    732707
    733708
    734709    private class NewCollectionTask
    735         extends Thread
    736     {
    737     private NewCollectionDetailsPrompt ncd_prompt = null;
    738     private NewCollectionMetadataPrompt ncm_prompt = null;
    739 
    740     public NewCollectionTask(NewCollectionDetailsPrompt ncd_prompt, NewCollectionMetadataPrompt ncm_prompt)
    741     {
    742         this.ncd_prompt = ncd_prompt;
    743         this.ncm_prompt = ncm_prompt;
    744     }
    745 
     710    extends Thread
     711    {
    746712    public void run()
    747713    {
    748         if (ncm_prompt == null) {
    749         Gatherer.c_man.createCollection(ncd_prompt.getDescription(), Configuration.getEmail(), ncd_prompt.getName(), ncd_prompt.getTitle(), ncd_prompt.getBase(), null);
    750         }
    751         else {
    752         Gatherer.c_man.createCollection(ncd_prompt.getDescription(), Configuration.getEmail(), ncd_prompt.getName(), ncd_prompt.getTitle(), null, ncm_prompt.getSets());
    753         ncm_prompt.dispose();
    754         ncm_prompt = null;
    755         }
    756 
    757         ncd_prompt.dispose();
     714        NewCollectionMetadataPrompt ncm_prompt = null;
     715        // Create the collection details prompt from new collection prompt
     716        NewCollectionDetailsPrompt ncd_prompt = new NewCollectionDetailsPrompt();
     717        // If no previous collection was indicated as a model design, then show the metadata selection prompt from new collection prompt
     718        if(!ncd_prompt.isCancelled() && (ncd_prompt.getBase() == null)) {
     719        ncm_prompt = new NewCollectionMetadataPrompt();
     720        }
     721        // Create the new collection (if not cancelled) in a new thread.
     722        if (!ncd_prompt.isCancelled() && (ncm_prompt == null || !ncm_prompt.isCancelled())) {
     723        // If there is already a collection open, save and close it.
     724        if (Gatherer.c_man.ready()) {
     725            saveThenCloseCurrentCollection();
     726        }
     727
     728        // Create new collection.
     729        if (ncm_prompt == null) {
     730            Gatherer.c_man.createCollection(ncd_prompt.getDescription(), Configuration.getEmail(), ncd_prompt.getName(), ncd_prompt.getTitle(), ncd_prompt.getBase(), null);
     731        }
     732        else {
     733            Gatherer.c_man.createCollection(ncd_prompt.getDescription(), Configuration.getEmail(), ncd_prompt.getName(), ncd_prompt.getTitle(), null, ncm_prompt.getSets());
     734            ncm_prompt.dispose();
     735        }
     736
     737        ncd_prompt.dispose();
     738
     739        // Return to some initial pane (Gather)
     740        returnToInitialPane();
     741
     742        // Refresh the workspace tree to allow for the new collection
     743        refreshWorkspaceTree(WorkspaceTree.LIBRARY_CONTENTS_CHANGED);
     744
     745        // Refresh the rest of the GLI
     746        Gatherer.refresh(Gatherer.COLLECTION_OPENED);
     747        }
     748
     749        // Done
    758750        ncd_prompt = null;
    759 
    760         // Return to some initial pane (Gather)
    761         returnToInitialPane();
    762 
    763         // Refresh the workspace tree to allow for the new collection
    764         refreshWorkspaceTree(WorkspaceTree.LIBRARY_CONTENTS_CHANGED);
    765 
    766         // Refresh the rest of the GLI
    767         Gatherer.refresh(Gatherer.COLLECTION_OPENED);
     751        ncm_prompt = null;
    768752    }
    769753    }
Note: See TracChangeset for help on using the changeset viewer.