Ignore:
Timestamp:
2004-11-09T13:54:52+13:00 (19 years ago)
Author:
mdewsnip
Message:

Started off fixing a bug where the loaded collection wasn't being ticked on in the cross-collection searching page. Ended up removing a ton of stuff from the CheckList class, some of which was duplicated code and buggy.

File:
1 edited

Legend:

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

    r8243 r8496  
    117117        super();
    118118
    119         buildModel();
    120119        // Creation
    121120        JPanel header_panel = new JPanel();
     
    135134        Dictionary.registerText(instructions, "CDM.SuperCollectionManager.Instructions");
    136135
    137         collection_checklist = new CheckList(collection_checklist_model, false);
     136        collection_checklist = new CheckList(false);
     137        buildModel();
     138        collection_checklist.setListData(collection_checklist_model);
    138139
    139140        // Layout
     
    189190    }
    190191
    191     private void buildModel() {
    192         // We start by building a model of the installed collections.
     192
     193    private void buildModel()
     194    {
    193195        collection_checklist_model = new ArrayList();
     196        current_coll_name = Gatherer.c_man.getCollection().getName();
     197
    194198        File gsdl_collection_directory;
    195199        if (Gatherer.GS3) {
    196200        gsdl_collection_directory = new File(Utility.getCollectDir(Configuration.gsdl3_path, Configuration.site_name));
    197         } else {
     201        }
     202        else {
    198203        gsdl_collection_directory = new File(Utility.getCollectDir(Configuration.gsdl_path));
    199204        }
    200         current_coll_name = Gatherer.c_man.getCollection().getName();
     205
    201206        File[] possible_collections = gsdl_collection_directory.listFiles();
    202207        for(int i = 0; possible_collections != null && i < possible_collections.length; i++) {
    203         // The simpliest case is if the directory etc/collect.cfg file and a metadata/ in it. Thus it can easily be built upon.
    204208        File collect_cfg_file = new File(possible_collections[i], Utility.CONFIG_FILE);
    205         if(collect_cfg_file.exists()) {
     209        if (collect_cfg_file.exists()) {
    206210            BasicCollectionConfiguration collect_cfg = new BasicCollectionConfiguration(collect_cfg_file);
    207211            StringBuffer title_buffer = new StringBuffer(collect_cfg.getName());
     
    213217            title_buffer = null;
    214218            String collection_name = possible_collections[i].getName();
    215             // We do have to block the model collection.
    216             if(!collect_cfg.getName().equals("**title**")) {
    217             Entry entry = new Entry(collection_title);
    218             entry.setProperty(collection_name);
    219             // Check if a collection with this name exists. The current collection is always selected.
    220             entry.setSelected(getSuperCollection(collection_name) != null || collection_name.equals(current_coll_name));
    221             entry.setFixed(collection_name.equals(current_coll_name));
    222             collection_checklist_model.add(entry);
    223             entry = null;
    224 
     219
     220            // We have to block the model collection.
     221            if (collect_cfg.getName().equals("**title**")) {
     222            continue;
    225223            }
    226             collection_name = null;
    227             collection_title = null;
    228             collect_cfg = null;
     224
     225            // The current collection is always selected.
     226            Entry entry = new Entry(collection_title);
     227            entry.setProperty(collection_name);
     228            entry.setSelected(getSuperCollection(collection_name) != null || collection_name.equals(current_coll_name));
     229            entry.setFixed(collection_name.equals(current_coll_name));
     230            collection_checklist_model.add(entry);
    229231        }
    230         collect_cfg_file = null;
    231         }
    232         possible_collections = null;
    233         gsdl_collection_directory = null;
    234         // Sort the result.
    235         Collections.sort(collection_checklist_model);
     232        }
    236233    }
    237234    }
Note: See TracChangeset for help on using the changeset viewer.