Changeset 10556 for trunk/gli/src/org/greenstone/gatherer/cdm
- Timestamp:
- 2005-08-24T15:14:01+12:00 (19 years ago)
- Location:
- trunk/gli/src/org/greenstone/gatherer/cdm
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gli/src/org/greenstone/gatherer/cdm/ClassifierManager.java
r10370 r10556 809 809 ac.destroy(); 810 810 ac = null; 811 // cos I can't be bothered checking every argument to see if it has changed or not, we'll asasume that the configuration has changed if someone has clicked configure 812 Gatherer.c_man.configurationChanged(); 811 813 } 812 814 } … … 832 834 ac.destroy(); 833 835 ac = null; 836 // cos I can't be bothered checking every argument to see if it has changed or not, we'll asasume that the configuration has changed if someone has clicked configure 837 Gatherer.c_man.configurationChanged(); 834 838 } 835 839 } -
trunk/gli/src/org/greenstone/gatherer/cdm/CollectionDesignManager.java
r10530 r10556 90 90 static final public int NOTHING = 0; 91 91 static private int rebuildTypeRequired = NOTHING; //Rebuild type required if only design options have changed 92 static p rotectedboolean update_collect_cfg_required = false;92 static public boolean update_collect_cfg_required = false; 93 93 94 94 /** Constructor. Loads a certain collection configuration file, which is parsed into a DOM. This model is then registered with the command information managers, each of whom knows how to, and provides controls to, alter certain commands. … … 214 214 215 215 216 public void save() { 217 save(false); 218 } 216 219 /** Cause the current collection configuration to be written out to disk. 217 220 */ 218 public void save( )221 public void save(boolean force_save) 219 222 { 223 224 general_manager.loseFocus(); 225 if (!update_collect_cfg_required && !force_save) { 226 DebugStream.println("Asked to save the config file, but don't need to"); 227 return; 228 } 229 230 DebugStream.println("Saving the collection config file"); 231 220 232 // Release collection as necessary 221 233 String collection_name = Gatherer.c_man.getCollection().getName(); 222 234 boolean collection_released = false; 223 235 224 if ( update_collect_cfg_required &&Gatherer.c_man.built() && LocalLibraryServer.isRunning() == true) {236 if (Gatherer.c_man.built() && LocalLibraryServer.isRunning() == true) { 225 237 // Release the collection 226 238 LocalLibraryServer.releaseCollection(collection_name); … … 228 240 } 229 241 230 general_manager.loseFocus();231 242 collect_config.save(); 232 243 … … 237 248 } 238 249 239 if (update_collect_cfg_required) { 240 // Unset formats changed 241 update_collect_cfg_required = false; 242 } 250 // Unset formats changed 251 update_collect_cfg_required = false; 252 243 253 } 244 254 -
trunk/gli/src/org/greenstone/gatherer/cdm/CollectionMeta.java
r10345 r10556 27 27 package org.greenstone.gatherer.cdm; 28 28 29 import org.greenstone.gatherer.Gatherer; 29 30 import org.greenstone.gatherer.Configuration; 30 31 import org.greenstone.gatherer.util.Codec; … … 161 162 */ 162 163 public void setValue(String raw_value) { 164 // we need to check if the value has changed 165 String current_value = XMLTools.getValue(element); 166 String new_value = Codec.transform(raw_value, Codec.TEXT_TO_DOM); 167 if (!current_value.equals(new_value)) { 163 168 // Only raw html text can be given to setValue so we need to encode it 164 XMLTools.setValue(element, Codec.transform(raw_value, Codec.TEXT_TO_DOM)); 165 text = null; // Reset text 166 // And determine if this makes the metadata assigned 167 setAssigned(raw_value != null && raw_value.length() > 0); 169 XMLTools.setValue(element, new_value); 170 text = null; // Reset text 171 // And determine if this makes the metadata assigned 172 setAssigned(raw_value != null && raw_value.length() > 0); 173 Gatherer.c_man.configurationChanged(); 174 } 168 175 } 169 176 -
trunk/gli/src/org/greenstone/gatherer/cdm/CollectionMetaManager.java
r10345 r10556 56 56 if(!contains(metadata)) { 57 57 Element element = metadata.getElement(); 58 // Locate where we should insert this new subcollection.58 // Locate where we should insert this new metadata. 59 59 Node target_node = CollectionConfiguration.findInsertionPoint(element); 60 60 add(root, metadata, target_node); 61 Gatherer.c_man.configurationChanged(); 62 } 63 Gatherer.c_man.configurationChanged(); 61 if (!metadata.getValue(CollectionMeta.TEXT).equals("")) { 62 // if just adding an empty metadata, the configuration hasn't changed. 63 Gatherer.c_man.configurationChanged(); 64 } 65 } 66 //Gatherer.c_man.configurationChanged(); 64 67 } 65 68 -
trunk/gli/src/org/greenstone/gatherer/cdm/GeneralManager.java
r10552 r10556 355 355 collection_extra_collectionmeta = CollectionDesignManager.collectionmeta_manager.getMetadatum(CollectionConfiguration.COLLECTIONMETADATA_COLLECTIONEXTRA_STR); 356 356 collection_name_collectionmeta = CollectionDesignManager.collectionmeta_manager.getMetadatum(CollectionConfiguration.COLLECTIONMETADATA_COLLECTIONNAME_STR); 357 357 358 creator_collectionmeta = new CollectionMeta(CollectionDesignManager.collect_config.getCreator()); 358 359 icon_collection_collectionmeta = CollectionDesignManager.collectionmeta_manager.getMetadatum(CollectionConfiguration.COLLECTIONMETADATA_ICONCOLLECTION_STR); -
trunk/gli/src/org/greenstone/gatherer/cdm/PluginManager.java
r10370 r10556 972 972 ac.destroy(); 973 973 ac = null; 974 // cos I can't be bothered checking every argument to see if it has changed or not, we'll asasume that the configuration has changed if someone has clicked configure 975 Gatherer.c_man.configurationChanged(); 974 976 } 975 977 } … … 996 998 ac.destroy(); 997 999 ac = null; 1000 // cos I can't be bothered checking every argument to see if it has changed or not, we'll asasume that the configuration has changed if someone has clicked configure 1001 Gatherer.c_man.configurationChanged(); 998 1002 } 999 1003 } -
trunk/gli/src/org/greenstone/gatherer/cdm/SearchTypeManager.java
r10528 r10556 222 222 } 223 223 } else { 224 build_type.setValue((String)build_type_combobox.getSelectedItem());224 //build_type.setValue((String)build_type_combobox.getSelectedItem()); 225 225 build_type.setAssigned(isSearchTypeEnabled()); 226 226 … … 427 427 Gatherer.g_man.wait(true); 428 428 boolean advanced_search_enabled = enable_advanced_searches_checkbox.isSelected(); 429 429 430 model.root.setAttribute(CollectionConfiguration.ASSIGNED_ATTRIBUTE, (advanced_search_enabled ? CollectionConfiguration.TRUE_STR : CollectionConfiguration.FALSE_STR)); 430 431 CollectionDesignManager.index_manager.setMGPPEnabled(advanced_search_enabled); 431 432 validateControls(advanced_search_enabled); 432 build_type.setAssigned(advanced_search_enabled); 433 if ((!build_type.isAssigned() && advanced_search_enabled) || 434 (build_type.isAssigned() && !advanced_search_enabled)) { 435 436 build_type.setAssigned(advanced_search_enabled); 437 Gatherer.c_man.configurationChanged(); 438 } 439 if (build_type.isAssigned() && build_type.getValue(true).equals("")) { 440 build_type.setValue((String)build_type_combobox.getSelectedItem()); 441 } 433 442 Gatherer.g_man.wait(false); 434 443 } … … 439 448 440 449 public void actionPerformed(ActionEvent event) { 441 build_type.setValue((String)build_type_combobox.getSelectedItem()); 442 } 443 450 if (!build_type.getValue(CollectionMeta.TEXT).equals((String)build_type_combobox.getSelectedItem())) { 451 build_type.setValue((String)build_type_combobox.getSelectedItem()); 452 } 453 } 454 444 455 } 445 456 /** Listenes for actions on the Remove button, and if detected removes the currently selected search types. */ -
trunk/gli/src/org/greenstone/gatherer/cdm/SuperCollectionManager.java
r10237 r10556 75 75 if(!contains(supercollection)) { 76 76 add(getSize(), supercollection); 77 } 77 Gatherer.c_man.configurationChanged(); 78 } 79 78 80 } 79 81 … … 103 105 104 106 private void removeSuperCollection(SuperCollection supercollection) { 105 remove(supercollection); 107 if(contains(supercollection)) { 108 remove(supercollection); 109 Gatherer.c_man.configurationChanged(); 110 } 106 111 } 107 112 … … 162 167 ArrayList supercollections = children(); 163 168 // Now iterate through the checklist, and for each checked box found ensure the Supercollection exists, and ensure its assigned. Remove any supercollections altered in this way from the temporary array list 169 // we ignore the current coll at the moment 164 170 int size = collection_checklist_model.size(); 165 171 for(int i = 0; i < size; i++) { … … 167 173 if(entry.isSelected()) { 168 174 String collection_name = (String) entry.getProperty(); 169 SuperCollection supercollection = getSuperCollection(collection_name); 170 // Create the supercollection element if necessary 171 if(supercollection == null) { 172 Element supercollection_element = root.getOwnerDocument().createElement(StaticStrings.COLLECTION_ELEMENT); 173 supercollection = new SuperCollection(supercollection_element); 174 supercollection.setName(collection_name); 175 addSuperCollection(supercollection); 175 if (!collection_name.equals(current_coll_name)) { 176 SuperCollection supercollection = getSuperCollection(collection_name); 177 // Create the supercollection element if necessary 178 if(supercollection == null) { 179 Element supercollection_element = root.getOwnerDocument().createElement(StaticStrings.COLLECTION_ELEMENT); 180 supercollection = new SuperCollection(supercollection_element); 181 supercollection.setName(collection_name); 182 addSuperCollection(supercollection); 183 } 184 else { 185 supercollections.remove(supercollection); 186 } 187 supercollection.setAssigned(true); 188 super_collections_count++; 176 189 } 177 else { 178 supercollections.remove(supercollection); 179 } 180 supercollection.setAssigned(true); 181 super_collections_count++; 182 } 183 } 190 } 191 } 192 if (super_collections_count > 0) { 193 // we have some super colls, add in the current collection 194 SuperCollection supercollection = getSuperCollection(current_coll_name); 195 // Create the supercollection element if necessary 196 if(supercollection == null) { 197 Element supercollection_element = root.getOwnerDocument().createElement(StaticStrings.COLLECTION_ELEMENT); 198 supercollection = new SuperCollection(supercollection_element); 199 supercollection.setName(current_coll_name); 200 addSuperCollection(supercollection); 201 } 202 else { 203 supercollections.remove(supercollection); 204 } 205 model.root.setAttribute(StaticStrings.ASSIGNED_ATTRIBUTE, StaticStrings.TRUE_STR); 206 } else { 207 // current collection is the only one - don't bother adding it, because assigned is false, and we don't want to update the config file for an unassigned item. 208 model.root.setAttribute(StaticStrings.ASSIGNED_ATTRIBUTE, StaticStrings.FALSE_STR); 209 } 210 184 211 // Any collections left in the temporary list have been unselected, so delete them 185 212 for(int j = supercollections.size(); j > 0; j--) { … … 187 214 removeSuperCollection(supercollection); 188 215 } 189 // Now we only assign supercollections if more than one is selected 190 model.root.setAttribute(StaticStrings.ASSIGNED_ATTRIBUTE, (super_collections_count > 1 ? StaticStrings.TRUE_STR : StaticStrings.FALSE_STR)); 191 } 192 193 216 } 217 218 194 219 private void buildModel() 195 220 { -
trunk/gli/src/org/greenstone/gatherer/cdm/TranslationView.java
r10237 r10556 36 36 import org.greenstone.gatherer.DebugStream; 37 37 import org.greenstone.gatherer.Dictionary; 38 import org.greenstone.gatherer.Gatherer; 38 39 import org.greenstone.gatherer.gui.GLIButton; 39 40 … … 377 378 translation_text = null; 378 379 remove_button.setEnabled(true); 380 Gatherer.c_man.configurationChanged(); 379 381 } 380 382 add_button.setEnabled(false); … … 396 398 // If a remove occured then enable add 397 399 add_button.setEnabled(true); 400 Gatherer.c_man.configurationChanged(); 398 401 } 399 402 // Either way disable replace and remove … … 419 422 metadata = null; 420 423 remove_button.setEnabled(true); 424 Gatherer.c_man.configurationChanged(); 421 425 } 422 426 // Either way disable replace
Note:
See TracChangeset
for help on using the changeset viewer.