Changeset 10975
- Timestamp:
- 2005-12-02T16:31:00+13:00 (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gli/src/org/greenstone/gatherer/cdm/IndexManager.java
r10966 r10975 52 52 53 53 static final private Dimension FIELD_SIZE = new Dimension(200,30); 54 static final private String MGINDEXES = "mg indexes";55 static final private String MGPPINDEXES = "mgpp indexes";56 54 57 55 static final private String ALLFIELDS = "allfields"; … … 98 96 else { 99 97 add(index); 100 // Also set this index as the default one, but only if there are levels available (ie mg only) 101 if(index.getLevel() != -1) { 102 setDefault(index); 103 } 98 // Also set this index as the default one, 99 setDefault(index); 104 100 } 105 101 Gatherer.c_man.configurationChanged(); … … 278 274 // Remove any current metadata from this index 279 275 CollectionDesignManager.collectionmeta_manager.removeMetadata(CollectionConfiguration.STOP_CHARACTER + index.getID()); 276 // Remove the index 277 remove(index); 280 278 // Check if the index removed happens to be the default index 281 279 if(default_index != null && default_index.equals(index)) { … … 289 287 default_index.setAssigned(false); 290 288 } 291 } 292 // Remove the index 293 remove(index); 289 } 294 290 Gatherer.c_man.configurationChanged(); 295 291 } … … 315 311 if (!old_index.getID().equals(new_index.getID()) && contains(new_index)) { 316 312 // shoudl we output an error?? 317 System.err.println("new index is already in the list, but is not the old one");318 313 return; 319 314 } … … 356 351 default_index.setLevel(index.getLevel()); 357 352 default_index.setSources(index.getSources()); 353 358 354 } 359 355 else { … … 453 449 int levels_list_size = levels_list.size(); 454 450 for(int k = 0; k < levels_list_size; k++) { 455 Level new_level = new Level((String)levels_list.get(k)); 451 String level_name = (String)levels_list.get(k); 452 Level new_level = new Level(level_name); 456 453 if(!levels_model.contains(new_level)) { 457 levels_model.add(levels_model.getSize(), new_level); 454 CollectionMeta metadatum = CollectionDesignManager.collectionmeta_manager.getMetadatum(CollectionConfiguration.STOP_CHARACTER + level_name, false); 455 // If no metadata was found, add new pseudo metadata using the id 456 if(metadatum == null) { 457 metadatum = new CollectionMeta(CollectionConfiguration.STOP_CHARACTER + level_name); 458 metadatum.setAssigned(true); 459 metadatum.setValue(level_name); 460 } 461 addLevel(new_level, metadatum); 458 462 } 459 463 new_level = null; 464 460 465 } 461 466 } … … 468 473 mg_element.setAttribute(CollectionConfiguration.ASSIGNED_ATTRIBUTE, CollectionConfiguration.FALSE_STR); 469 474 mg_element = null; 470 if(default_index != null) {471 //default_index.setAssigned(false);472 default_index.setLevel(-1);473 }474 475 } 475 476 // change MGPP -> MG … … 479 480 Element mg_element = CollectionDesignManager.collect_config.getMGIndexes(); 480 481 mg_element.setAttribute(CollectionConfiguration.ASSIGNED_ATTRIBUTE, CollectionConfiguration.TRUE_STR); 481 if(default_index != null) {482 default_index.setAssigned(true);483 default_index.setLevel(1); // for now484 }485 482 // If mg element has no indexes, and the current mgpp index include a text one, then generate text indexes for each of the registered levels. 486 483 NodeList indexes = mg_element.getElementsByTagName(CollectionConfiguration.INDEX_ELEMENT); … … 522 519 levels_model.root.setAttribute(CollectionConfiguration.ASSIGNED_ATTRIBUTE, CollectionConfiguration.FALSE_STR); 523 520 } 521 // its really hard to transfer defaults between mg and mgpp. so we'll just assign the first one to be the default. 522 Index first_index = (Index) getElementAt(0); 523 setDefault(first_index); 524 first_index = null; 525 524 526 525 527 } … … 803 805 tabbed_pane.remove(0); 804 806 add(main_index_pane, BorderLayout.CENTER); 807 source_list.setEnabled(true); // in case it had been disabled 808 allfields_box.setSelected(false); 805 809 } 806 810 } … … 830 834 source_list.clearTicked(); 831 835 ArrayList sources = selected_index.getSources(); 832 source_list.setTickedObjects(sources.toArray()); 833 836 if (mgpp_enabled && sources.get(0).equals(ALLFIELDS)) { 837 source_list.setEnabled(false); 838 allfields_box.setSelected(true); 839 } else { 840 source_list.setTickedObjects(sources.toArray()); 841 source_list.setEnabled(true); 842 allfields_box.setSelected(false); 843 } 834 844 } 835 845 … … 1117 1127 } 1118 1128 index_list.setSelectedIndex(i); 1119 1120 1129 // This will produce an event on the list, updating the other buttons 1121 1130 if (size == 0) {
Note:
See TracChangeset
for help on using the changeset viewer.