Changeset 19224 for gli


Ignore:
Timestamp:
2009-04-23T14:11:18+12:00 (15 years ago)
Author:
kjdon
Message:

added code for collect groups

File:
1 edited

Legend:

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

    r18412 r19224  
    207207
    208208   
    209     private void buildModel()
    210     {
    211         collection_checklist_model = new ArrayList();
    212         current_coll_name = CollectionManager.getLoadedCollectionName();
    213 
    214         File collect_directory = new File(Gatherer.getCollectDirectoryPath());
    215         File[] possible_collections = collect_directory.listFiles();
    216         for(int i = 0; possible_collections != null && i < possible_collections.length; i++) {
    217         String file_name = (Gatherer.GS3)? Utility.CONFIG_GS3_FILE : Utility.CONFIG_FILE;
    218         File collect_cfg_file = new File(possible_collections[i], file_name);
    219         if (collect_cfg_file.exists()) {
    220             BasicCollectionConfiguration collect_cfg = new BasicCollectionConfiguration(collect_cfg_file);
    221             StringBuffer title_buffer = new StringBuffer(collect_cfg.getName());
    222             title_buffer.append(StaticStrings.SPACE_CHARACTER);
    223             title_buffer.append(StaticStrings.OPEN_PARENTHESIS_CHARACTER);
    224             title_buffer.append(possible_collections[i].getName());
    225             title_buffer.append(StaticStrings.CLOSE_PARENTHESIS_CHARACTER);
    226             String collection_title = title_buffer.toString();
    227             title_buffer = null;
    228             String collection_name = possible_collections[i].getName();
    229 
    230             // We have to block the model collection.
    231             if (collect_cfg.getName().equals("**title**")) {
    232             continue;
    233             }
    234 
    235             // The current collection is always selected.
    236             CheckListEntry entry = new CheckListEntry(collection_title);
    237             entry.setProperty(collection_name);
    238             entry.setSelected(getSuperCollection(collection_name) != null || collection_name.equals(current_coll_name));
    239             entry.setFixed(collection_name.equals(current_coll_name));
    240             collection_checklist_model.add(entry);
    241         }
    242         }
    243     }
     209      private void buildModel()
     210      {
     211    collection_checklist_model = new ArrayList();
     212    current_coll_name = CollectionManager.getLoadedGroupQualifiedCollectionName(true);
     213    File collect_directory = new File(Gatherer.getCollectDirectoryPath());
     214    add_collections_to_model(collect_directory);
     215      }
     216
     217      private void add_collections_to_model(File collect_directory) {
     218    File[] possible_collections = collect_directory.listFiles();
     219    for(int i = 0; possible_collections != null && i < possible_collections.length; i++) {
     220      String file_name = (Gatherer.GS3)? Utility.CONFIG_GS3_FILE : Utility.CONFIG_FILE;
     221      File collect_cfg_file = new File(possible_collections[i], file_name);
     222      if (collect_cfg_file.exists()) {
     223        BasicCollectionConfiguration collect_cfg = new BasicCollectionConfiguration(collect_cfg_file);
     224        // look to see if group set?
     225        // => if it is, don't add, but recurse to look for child collections in collect-group
     226        if (collect_cfg.getCollectGroup().equals("true")) {
     227          add_collections_to_model(possible_collections[i]);
     228        } else {
     229          // its a collection
     230          StringBuffer title_buffer = new StringBuffer(collect_cfg.getName());
     231          title_buffer.append(StaticStrings.SPACE_CHARACTER);
     232          title_buffer.append(StaticStrings.OPEN_PARENTHESIS_CHARACTER);
     233          title_buffer.append(collect_cfg.getShortName());
     234          title_buffer.append(StaticStrings.CLOSE_PARENTHESIS_CHARACTER);
     235          String collection_title = title_buffer.toString();
     236          title_buffer = null;
     237          String collection_name = collect_cfg.getShortName();
     238          // We have to block the model collection.
     239          if (collect_cfg.getName().equals("**title**")) {
     240        continue;
     241          }
     242
     243          // The current collection is always selected.
     244          CheckListEntry entry = new CheckListEntry(collection_title);
     245          entry.setProperty(collection_name);
     246          entry.setSelected(getSuperCollection(collection_name) != null || collection_name.equals(current_coll_name));
     247          entry.setFixed(collection_name.equals(current_coll_name));
     248          collection_checklist_model.add(entry);
     249        }
     250      }
     251     
     252    }
     253      }
    244254    }
    245255}
Note: See TracChangeset for help on using the changeset viewer.