Changeset 8496 for trunk/gli/src/org/greenstone/gatherer/cdm
- Timestamp:
- 2004-11-09T13:54:52+13:00 (20 years ago)
- Location:
- trunk/gli/src/org/greenstone/gatherer/cdm
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gli/src/org/greenstone/gatherer/cdm/IndexManager.java
r8381 r8496 576 576 JLabel source_label = new JLabel(); 577 577 Dictionary.registerText(source_label, "CDM.IndexManager.Source"); 578 source_list = new CheckList(new_data, false); 578 source_list = new CheckList(false); 579 source_list.setListData(new_data); 579 580 Dictionary.registerTooltip(source_list, "CDM.IndexManager.Source_Tooltip"); 580 581 … … 696 697 new_data.addAll(MetadataSetManager.getEveryMetadataSetElement()); 697 698 // reset the model in the list and combobox 698 source_list.setListData(new_data .toArray());699 source_list.setListData(new_data); 699 700 new_data = null; 700 701 // refresh the indexList … … 742 743 } 743 744 // Can't add a new index if no sources are selected 744 else if (source_list.isSelectionEmpty()) {745 else if (source_list.getSelected().size() == 0) { 745 746 add_enabled = false; 746 747 } … … 795 796 public void actionPerformed(ActionEvent event) { 796 797 String name = name_textfield.getText(); 797 if (!source_list.isSelectionEmpty()&& name.length() != 0) {798 if (source_list.getSelected().size() > 0 && name.length() != 0) { 798 799 ArrayList sources = source_list.getSelected(); 799 800 Index index = new Index(level_combobox.getSelectedIndex(), sources); -
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.