- Timestamp:
- 2004-11-09T13:54:52+13:00 (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gli/src/org/greenstone/gatherer/cdm/SuperCollectionManager.java
r8243 r8496 117 117 super(); 118 118 119 buildModel();120 119 // Creation 121 120 JPanel header_panel = new JPanel(); … … 135 134 Dictionary.registerText(instructions, "CDM.SuperCollectionManager.Instructions"); 136 135 137 collection_checklist = new CheckList(collection_checklist_model, false); 136 collection_checklist = new CheckList(false); 137 buildModel(); 138 collection_checklist.setListData(collection_checklist_model); 138 139 139 140 // Layout … … 189 190 } 190 191 191 private void buildModel() { 192 // We start by building a model of the installed collections. 192 193 private void buildModel() 194 { 193 195 collection_checklist_model = new ArrayList(); 196 current_coll_name = Gatherer.c_man.getCollection().getName(); 197 194 198 File gsdl_collection_directory; 195 199 if (Gatherer.GS3) { 196 200 gsdl_collection_directory = new File(Utility.getCollectDir(Configuration.gsdl3_path, Configuration.site_name)); 197 } else { 201 } 202 else { 198 203 gsdl_collection_directory = new File(Utility.getCollectDir(Configuration.gsdl_path)); 199 204 } 200 current_coll_name = Gatherer.c_man.getCollection().getName(); 205 201 206 File[] possible_collections = gsdl_collection_directory.listFiles(); 202 207 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.204 208 File collect_cfg_file = new File(possible_collections[i], Utility.CONFIG_FILE); 205 if (collect_cfg_file.exists()) {209 if (collect_cfg_file.exists()) { 206 210 BasicCollectionConfiguration collect_cfg = new BasicCollectionConfiguration(collect_cfg_file); 207 211 StringBuffer title_buffer = new StringBuffer(collect_cfg.getName()); … … 213 217 title_buffer = null; 214 218 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; 225 223 } 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); 229 231 } 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 } 236 233 } 237 234 }
Note:
See TracChangeset
for help on using the changeset viewer.