Changeset 13586


Ignore:
Timestamp:
2007-01-12T14:05:00+13:00 (15 years ago)
Author:
mdewsnip
Message:

Added a static getLoadedCollectionName() function into CollectionManager, as part of making CollectionManager fully static.

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

Legend:

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

    r13421 r13586  
    3636import org.greenstone.gatherer.Gatherer;
    3737import org.greenstone.gatherer.LocalLibraryServer;
     38import org.greenstone.gatherer.collection.CollectionManager;
    3839import org.greenstone.gatherer.gui.GLIButton;
    3940import org.greenstone.gatherer.metadata.MetadataElement;
     
    484485
    485486    // If we're using the Local Library we must release the collection before writing to the collect.cfg file
    486     String collection_name = Gatherer.c_man.getCollection().getName();
     487    String collection_name = CollectionManager.getLoadedCollectionName();
    487488    boolean collection_released = false;
    488489    if (Gatherer.c_man.built() && LocalLibraryServer.isRunning() == true) {
  • trunk/gli/src/org/greenstone/gatherer/cdm/GeneralManager.java

    r13453 r13586  
    3838import org.greenstone.gatherer.Dictionary;
    3939import org.greenstone.gatherer.Gatherer;
     40import org.greenstone.gatherer.collection.CollectionManager;
    4041import org.greenstone.gatherer.gui.DesignPaneHeader;
    4142import org.greenstone.gatherer.gui.EmailField;
     
    152153       
    153154        JLabel short_name_label = new JLabel(Dictionary.get("NewCollectionPrompt.Collection_Name"));
    154         JTextField short_name_textfield = new JTextField(Gatherer.c_man.getCollection().getName());
     155        JTextField short_name_textfield = new JTextField(CollectionManager.getLoadedCollectionName());
    155156        short_name_textfield.setEditable(false);
    156157        short_name_textfield.setBackground(Configuration.getColor("coloring.collection_tree_background", false));
     
    317318
    318319        public BrowseListener(String prefix_raw) {
    319         this.prefix = prefix_raw.replaceAll(StaticStrings.COLNAME_PATTERN, Gatherer.c_man.getCollection().getName());
     320        this.prefix = prefix_raw.replaceAll(StaticStrings.COLNAME_PATTERN, CollectionManager.getLoadedCollectionName());
    320321        }
    321322
     
    346347                // If we're using a remote Greenstone server, upload the image
    347348                if (Gatherer.isGsdlRemote) {
    348                 RemoteGreenstoneServer.uploadCollectionFile(Gatherer.c_man.getCollection().getName(), collection_image_file);
     349                RemoteGreenstoneServer.uploadCollectionFile(CollectionManager.getLoadedCollectionName(), collection_image_file);
    349350                }
    350351            }
     
    415416        // Set the title
    416417        String collection_title = name_textfield.getText();
    417         String collection_name = Gatherer.c_man.getCollection().getName();
     418        String collection_name = CollectionManager.getLoadedCollectionName();
    418419        Gatherer.g_man.setTitle(collection_title, collection_name);
    419420                collection_name_collectionmeta.setValue(name_textfield.getText());
  • trunk/gli/src/org/greenstone/gatherer/cdm/MacrosManager.java

    r12652 r13586  
    4141import java.io.OutputStreamWriter;
    4242
    43 import org.greenstone.gatherer.collection.CollectionManager;
    4443import org.greenstone.gatherer.Configuration;
    4544import org.greenstone.gatherer.DebugStream;
    4645import org.greenstone.gatherer.Dictionary;
    4746import org.greenstone.gatherer.Gatherer;
     47import org.greenstone.gatherer.collection.CollectionManager;
    4848import org.greenstone.gatherer.gui.DesignPaneHeader;
    4949import org.greenstone.gatherer.gui.GLIButton;
     
    217217        // Users need to wait until the upload has finished before pressing Preview Collection!
    218218        if (Gatherer.isGsdlRemote) {
    219             String collection_name = Gatherer.c_man.getCollection().getName();
    220             RemoteGreenstoneServer.uploadCollectionFile(collection_name, extra_dm_file);
     219            RemoteGreenstoneServer.uploadCollectionFile(CollectionManager.getLoadedCollectionName(), extra_dm_file);
    221220        }
    222221        }
  • trunk/gli/src/org/greenstone/gatherer/cdm/SuperCollectionManager.java

    r12809 r13586  
    3636import org.greenstone.gatherer.Gatherer;
    3737import org.greenstone.gatherer.collection.BasicCollectionConfiguration;
     38import org.greenstone.gatherer.collection.CollectionManager;
    3839import org.greenstone.gatherer.util.CheckList;
    3940import org.greenstone.gatherer.util.CheckListEntry;
     
    207208    {
    208209        collection_checklist_model = new ArrayList();
    209         current_coll_name = Gatherer.c_man.getCollection().getName();
     210        current_coll_name = CollectionManager.getLoadedCollectionName();
    210211
    211212        File collect_directory = new File(Gatherer.getCollectDirectoryPath());
  • trunk/gli/src/org/greenstone/gatherer/collection/CollectionManager.java

    r13585 r13586  
    562562    public Collection getCollection() {
    563563    return collection;
     564    }
     565
     566
     567    /** Returns the name of the loaded collection.
     568     */
     569    static public String getLoadedCollectionName()
     570    {
     571    if (collection != null) {
     572        return collection.getName();
     573    }
     574
     575    return null;
    564576    }
    565577
  • trunk/gli/src/org/greenstone/gatherer/file/FileManager.java

    r13455 r13586  
    4141import org.greenstone.gatherer.Dictionary;
    4242import org.greenstone.gatherer.Gatherer;
     43import org.greenstone.gatherer.collection.CollectionManager;
    4344import org.greenstone.gatherer.collection.CollectionTree;
    4445import org.greenstone.gatherer.collection.CollectionTreeNode;
     
    169170        file_queue.addJob(id, source, source_nodes, target, target_node, type);
    170171        if (Gatherer.isGsdlRemote) {
    171             String collection_name = Gatherer.c_man.getCollection().getName();
     172            String collection_name = CollectionManager.getLoadedCollectionName();
    172173
    173174            // Perform the appropriate action based on the job type (RemoteGreenstoneServer will queue)
     
    248249        // ... but only if it is inside the collection and we haven't already downloaded it
    249250        if (file.getAbsolutePath().startsWith(Gatherer.getCollectDirectoryPath()) && file.length() == 0) {
    250             if (RemoteGreenstoneServer.downloadCollectionFile(Gatherer.c_man.getCollection().getName(), file).equals("")) {
     251            if (RemoteGreenstoneServer.downloadCollectionFile(CollectionManager.getLoadedCollectionName(), file).equals("")) {
    251252            // Something has gone wrong downloading the file
    252253            return;
     
    323324                folder_file.createNewFile();
    324325                if (Gatherer.isGsdlRemote) {
    325                 RemoteGreenstoneServer.uploadCollectionFile(Gatherer.c_man.getCollection().getName(), folder_file);
     326                RemoteGreenstoneServer.uploadCollectionFile(CollectionManager.getLoadedCollectionName(), folder_file);
    326327                }
    327328            }
     
    329330                folder_file.mkdirs();
    330331                if (Gatherer.isGsdlRemote) {
    331                 RemoteGreenstoneServer.newCollectionDirectory(Gatherer.c_man.getCollection().getName(), folder_file);
     332                RemoteGreenstoneServer.newCollectionDirectory(CollectionManager.getLoadedCollectionName(), folder_file);
    332333                }
    333334            }
  • trunk/gli/src/org/greenstone/gatherer/gui/DeleteCollectionPrompt.java

    r13584 r13586  
    4848import org.greenstone.gatherer.Gatherer;
    4949import org.greenstone.gatherer.collection.BasicCollectionConfiguration;
     50import org.greenstone.gatherer.collection.CollectionManager;
    5051import org.greenstone.gatherer.file.WorkspaceTree;  // !!! Don't like this here
    5152import org.greenstone.gatherer.util.ArrayTools;
     
    293294        Gatherer.g_man.refreshWorkspaceTree(WorkspaceTree.LIBRARY_CONTENTS_CHANGED);
    294295
    295         if (Gatherer.c_man.getCollection() != null && collection.getShortName().equals(Gatherer.c_man.getCollection().getName())) {
     296        if (Gatherer.c_man.getCollection() != null && collection.getShortName().equals(CollectionManager.getLoadedCollectionName())) {
    296297            current_coll_deleted = true;
    297298        }
  • trunk/gli/src/org/greenstone/gatherer/gui/ExplodeMetadataDatabasePrompt.java

    r13579 r13586  
    271271    else {
    272272        // Add in the filename, relative to the collection directory
    273         String collection_name = Gatherer.c_man.getCollection().getName();
     273        String collection_name = CollectionManager.getLoadedCollectionName();
    274274        String collection_directory_path = CollectionManager.getCollectionDirectoryPath(collection_name);
    275275        String metadata_file_relative_path = RemoteGreenstoneServer.getPathRelativeToDirectory(metadata_file, collection_directory_path);
     
    344344        if (Gatherer.isGsdlRemote) {
    345345            Utility.delete(metadata_file.getParentFile());
    346             RemoteGreenstoneServer.downloadCollectionFile(Gatherer.c_man.getCollection().getName(), metadata_file.getParentFile());
     346            RemoteGreenstoneServer.downloadCollectionFile(CollectionManager.getLoadedCollectionName(), metadata_file.getParentFile());
    347347        }
    348348
  • trunk/gli/src/org/greenstone/gatherer/metadata/MetadataXMLFileManager.java

    r12735 r13586  
    3232import org.greenstone.gatherer.DebugStream;
    3333import org.greenstone.gatherer.Gatherer;
     34import org.greenstone.gatherer.collection.CollectionManager;
    3435import org.greenstone.gatherer.collection.CollectionTreeNode;
    3536import org.greenstone.gatherer.remote.RemoteGreenstoneServer;
     
    377378
    378379        // Upload the files modified since last time, then reset the list
    379         RemoteGreenstoneServer.uploadCollectionFiles(Gatherer.c_man.getCollection().getName(), (File[]) modified_metadata_xml_files.toArray(new File[0]));
     380        RemoteGreenstoneServer.uploadCollectionFiles(CollectionManager.getLoadedCollectionName(), (File[]) modified_metadata_xml_files.toArray(new File[0]));
    380381        modified_metadata_xml_files.clear();
    381382    }
Note: See TracChangeset for help on using the changeset viewer.