Changeset 12641
- Timestamp:
- 2006-09-01T11:38:53+12:00 (18 years ago)
- Location:
- trunk/gli/src/org/greenstone/gatherer
- Files:
-
- 21 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gli/src/org/greenstone/gatherer/cdm/ArgumentContainer.java
r12466 r12641 37 37 import org.w3c.dom.*; 38 38 39 /**************************************************************************************40 * Written: 20/05/0241 * Revised: 03/07/0342 **************************************************************************************/43 import java.util.ArrayList;44 39 45 40 /** This class provides an interface to any class that contains a list of Arguments. … … 228 223 229 224 public boolean isAssigned() { 230 return (element != null && !element.getAttribute( CollectionConfiguration.ASSIGNED_ATTRIBUTE).equals(CollectionConfiguration.FALSE_STR));225 return (element != null && !element.getAttribute(StaticStrings.ASSIGNED_ATTRIBUTE).equals(StaticStrings.FALSE_STR)); 231 226 } 232 227 233 228 public void setAssigned(boolean assigned) { 234 229 if(element != null) { 235 element.setAttribute( CollectionConfiguration.ASSIGNED_ATTRIBUTE, (assigned ? CollectionConfiguration.TRUE_STR : CollectionConfiguration.FALSE_STR));230 element.setAttribute(StaticStrings.ASSIGNED_ATTRIBUTE, (assigned ? StaticStrings.TRUE_STR : StaticStrings.FALSE_STR)); 236 231 } 237 232 } -
trunk/gli/src/org/greenstone/gatherer/cdm/ClassifierManager.java
r12638 r12641 72 72 */ 73 73 public ClassifierManager() { 74 super(CollectionDesignManager.collect_config.getDocumentElement(), CollectionConfiguration.CLASSIFY_ELEMENT, new Classifier());74 super(CollectionDesignManager.collect_config.getDocumentElement(), StaticStrings.CLASSIFY_ELEMENT, new Classifier()); 75 75 this.model = this; 76 76 DebugStream.println("ClassifierManager: " + getSize() + " classifiers parsed."); … … 232 232 } 233 233 else if (node_name.equals("Abstract")) { 234 classifier.setIsAbstract(XMLTools.getValue(node).equalsIgnoreCase( CollectionConfiguration.YES_STR));234 classifier.setIsAbstract(XMLTools.getValue(node).equalsIgnoreCase(StaticStrings.YES_STR)); 235 235 } 236 236 // Parse the classifier arguments … … 598 598 599 599 // Create a new element in the DOM 600 Element new_classifier_element = CollectionDesignManager.collect_config.document.createElement( CollectionConfiguration.CLASSIFY_ELEMENT);601 new_classifier_element.setAttribute( CollectionConfiguration.TYPE_ATTRIBUTE, classifier.getName());600 Element new_classifier_element = CollectionDesignManager.collect_config.document.createElement(StaticStrings.CLASSIFY_ELEMENT); 601 new_classifier_element.setAttribute(StaticStrings.TYPE_ATTRIBUTE, classifier.getName()); 602 602 Classifier new_classifier = new Classifier(new_classifier_element, classifier); 603 603 -
trunk/gli/src/org/greenstone/gatherer/cdm/CollectionMeta.java
r11870 r12641 133 133 134 134 public boolean isAssigned() { 135 return (element != null && !element.getAttribute( CollectionConfiguration.ASSIGNED_ATTRIBUTE).equals(CollectionConfiguration.FALSE_STR));135 return (element != null && !element.getAttribute(StaticStrings.ASSIGNED_ATTRIBUTE).equals(StaticStrings.FALSE_STR)); 136 136 } 137 137 … … 149 149 public void setAssigned(boolean assigned) { 150 150 if(element != null) { 151 element.setAttribute( CollectionConfiguration.ASSIGNED_ATTRIBUTE, (assigned ? CollectionConfiguration.TRUE_STR : CollectionConfiguration.FALSE_STR));151 element.setAttribute(StaticStrings.ASSIGNED_ATTRIBUTE, (assigned ? StaticStrings.TRUE_STR : StaticStrings.FALSE_STR)); 152 152 } 153 153 } -
trunk/gli/src/org/greenstone/gatherer/cdm/DOMProxyListModel.java
r12414 r12641 30 30 import javax.swing.*; 31 31 import org.greenstone.gatherer.DebugStream; 32 import org.greenstone.gatherer.util.StaticStrings; 32 33 import org.w3c.dom.*; 33 34 … … 273 274 public synchronized void setAssigned(boolean assigned) { 274 275 if (assigned) { 275 root.setAttribute( CollectionConfiguration.ASSIGNED_ATTRIBUTE, CollectionConfiguration.TRUE_STR);276 } 277 else { 278 root.setAttribute( CollectionConfiguration.ASSIGNED_ATTRIBUTE, CollectionConfiguration.FALSE_STR);276 root.setAttribute(StaticStrings.ASSIGNED_ATTRIBUTE, StaticStrings.TRUE_STR); 277 } 278 else { 279 root.setAttribute(StaticStrings.ASSIGNED_ATTRIBUTE, StaticStrings.FALSE_STR); 279 280 } 280 281 } 281 282 282 283 public boolean isAssigned() { 283 return (root.getAttribute( CollectionConfiguration.ASSIGNED_ATTRIBUTE).equals("") || root.getAttribute(CollectionConfiguration.ASSIGNED_ATTRIBUTE).equals(CollectionConfiguration.TRUE_STR));284 return (root.getAttribute(StaticStrings.ASSIGNED_ATTRIBUTE).equals("") || root.getAttribute(StaticStrings.ASSIGNED_ATTRIBUTE).equals(StaticStrings.TRUE_STR)); 284 285 } 285 286 } -
trunk/gli/src/org/greenstone/gatherer/cdm/Format.java
r12301 r12641 29 29 import org.greenstone.gatherer.DebugStream; 30 30 import org.greenstone.gatherer.util.Codec; 31 import org.greenstone.gatherer.util.StaticStrings; 31 32 import org.greenstone.gatherer.util.XMLTools; 32 33 import org.w3c.dom.*; … … 126 127 public Format(Object feature, String part, boolean state) { 127 128 128 element = CollectionDesignManager.collect_config.document.createElement( CollectionConfiguration.FORMAT_ELEMENT);129 element = CollectionDesignManager.collect_config.document.createElement(StaticStrings.FORMAT_ELEMENT); 129 130 setName(feature, part); 130 131 setState(state); … … 139 140 public Format(Object feature, String part, String value) { 140 141 141 element = CollectionDesignManager.collect_config.document.createElement( CollectionConfiguration.FORMAT_ELEMENT);142 element = CollectionDesignManager.collect_config.document.createElement(StaticStrings.FORMAT_ELEMENT); 142 143 setName(feature, part); 143 144 setValue(value); … … 156 157 } 157 158 if(object instanceof Format && element != null) { 158 return element.getAttribute( CollectionConfiguration.NAME_ATTRIBUTE).compareTo(((Format)object).getName());159 return element.getAttribute(StaticStrings.NAME_ATTRIBUTE).compareTo(((Format)object).getName()); 159 160 } 160 161 return toString().compareTo(object.toString()); … … 203 204 public String getFeatureName() { 204 205 if (feature_name == null) { 205 String name = element.getAttribute( CollectionConfiguration.NAME_ATTRIBUTE);206 String name = element.getAttribute(StaticStrings.NAME_ATTRIBUTE); 206 207 // Remove part 207 208 String part = getPart(); … … 221 222 public String getName() { 222 223 if(element != null) { 223 String name = element.getAttribute( CollectionConfiguration.NAME_ATTRIBUTE);224 return element.getAttribute( CollectionConfiguration.NAME_ATTRIBUTE);224 String name = element.getAttribute(StaticStrings.NAME_ATTRIBUTE); 225 return element.getAttribute(StaticStrings.NAME_ATTRIBUTE); 225 226 } 226 227 return "Error"; … … 233 234 if(part == null && element != null) { 234 235 // To determine a part, we retrieve the Format name, then look for one of our recognized parts 235 String name = element.getAttribute( CollectionConfiguration.NAME_ATTRIBUTE);236 String name = element.getAttribute(StaticStrings.NAME_ATTRIBUTE); 236 237 // DEFAULT_PARTS[0] is an empty string to correctly enable comboboxes. 237 238 name = name.toLowerCase(); … … 252 253 */ 253 254 public boolean getState() { 254 return (element != null && element.getAttribute( CollectionConfiguration.VALUE_ATTRIBUTE).equals(CollectionConfiguration.TRUE_STR));255 return (element != null && element.getAttribute(StaticStrings.VALUE_ATTRIBUTE).equals(StaticStrings.TRUE_STR)); 255 256 } 256 257 … … 269 270 270 271 public boolean isAssigned() { 271 return (element != null && !element.getAttribute( CollectionConfiguration.ASSIGNED_ATTRIBUTE).equals(CollectionConfiguration.FALSE_STR));272 return (element != null && !element.getAttribute(StaticStrings.ASSIGNED_ATTRIBUTE).equals(StaticStrings.FALSE_STR)); 272 273 } 273 274 274 275 public boolean isParamType() { 275 return (element != null && element.getAttribute( CollectionConfiguration.VALUE_ATTRIBUTE).length() > 0);276 return (element != null && element.getAttribute(StaticStrings.VALUE_ATTRIBUTE).length() > 0); 276 277 } 277 278 278 279 public void setAssigned(boolean assigned) { 279 280 if(element != null) { 280 element.setAttribute( CollectionConfiguration.ASSIGNED_ATTRIBUTE, (assigned ? CollectionConfiguration.TRUE_STR : CollectionConfiguration.FALSE_STR));281 element.setAttribute(StaticStrings.ASSIGNED_ATTRIBUTE, (assigned ? StaticStrings.TRUE_STR : StaticStrings.FALSE_STR)); 281 282 } 282 283 } … … 298 299 classifier = (Classifier) feature; 299 300 feature_name = classifier.getPositionString(); 300 element.setAttribute( CollectionConfiguration.NAME_ATTRIBUTE, classifier.getPositionString() + part);301 element.setAttribute(StaticStrings.NAME_ATTRIBUTE, classifier.getPositionString() + part); 301 302 } 302 303 else { … … 307 308 feature_name = feature.toString(); 308 309 } 309 element.setAttribute( CollectionConfiguration.NAME_ATTRIBUTE, feature_name + part);310 element.setAttribute(StaticStrings.NAME_ATTRIBUTE, feature_name + part); 310 311 } 311 312 text = null; … … 318 319 public void setState(boolean state) { 319 320 if(element != null) { 320 element.setAttribute( CollectionConfiguration.VALUE_ATTRIBUTE, (state ? CollectionConfiguration.TRUE_STR : CollectionConfiguration.FALSE_STR));321 element.setAttribute(StaticStrings.VALUE_ATTRIBUTE, (state ? StaticStrings.TRUE_STR : StaticStrings.FALSE_STR)); 321 322 text = null; 322 323 } … … 329 330 if(element != null) { 330 331 // Strip off any enclosing speech marks 331 if(value.startsWith( CollectionConfiguration.SPEECH_CHARACTER) && value.startsWith(CollectionConfiguration.SPEECH_CHARACTER)) {332 if(value.startsWith(StaticStrings.SPEECH_CHARACTER) && value.startsWith(StaticStrings.SPEECH_CHARACTER)) { 332 333 value = value.substring(1, value.length() - 1); 333 334 } … … 346 347 if(text == null && element != null) { 347 348 StringBuffer temp = new StringBuffer(" "); 348 temp.append(element.getAttribute( CollectionConfiguration.NAME_ATTRIBUTE));349 temp.append(element.getAttribute(StaticStrings.NAME_ATTRIBUTE)); 349 350 temp.append(" "); 350 String value = element.getAttribute( CollectionConfiguration.VALUE_ATTRIBUTE);351 String value = element.getAttribute(StaticStrings.VALUE_ATTRIBUTE); 351 352 if(value.length() > 0) { 352 353 temp.append(value); … … 354 355 else { 355 356 value = XMLTools.getValue(element); 356 if(value.equalsIgnoreCase( CollectionConfiguration.TRUE_STR) || value.equalsIgnoreCase(CollectionConfiguration.FALSE_STR)) {357 if(value.equalsIgnoreCase(StaticStrings.TRUE_STR) || value.equalsIgnoreCase(StaticStrings.FALSE_STR)) { 357 358 temp.append(value); 358 359 } … … 373 374 public void update() { 374 375 if(classifier != null) { 375 element.setAttribute( CollectionConfiguration.NAME_ATTRIBUTE, classifier.getPositionString() + getPart());376 element.setAttribute(StaticStrings.NAME_ATTRIBUTE, classifier.getPositionString() + getPart()); 376 377 feature_name = classifier.getPositionString(); 377 378 text = null; -
trunk/gli/src/org/greenstone/gatherer/cdm/FormatManager.java
r12449 r12641 85 85 /** Constructor. */ 86 86 public FormatManager() { 87 super(CollectionDesignManager.collect_config.getDocumentElement(), CollectionConfiguration.FORMAT_ELEMENT, new Format());87 super(CollectionDesignManager.collect_config.getDocumentElement(), StaticStrings.FORMAT_ELEMENT, new Format()); 88 88 this.model = this; 89 89 -
trunk/gli/src/org/greenstone/gatherer/cdm/GeneralManager.java
r12123 r12641 169 169 // public 170 170 JPanel box_panel = new JPanel(); 171 public_checkbox = new JCheckBox(Dictionary.get("CDM.General.Access"), public_collectionmeta.getValue(CollectionMeta.TEXT).equals( CollectionConfiguration.TRUE_STR));171 public_checkbox = new JCheckBox(Dictionary.get("CDM.General.Access"), public_collectionmeta.getValue(CollectionMeta.TEXT).equals(StaticStrings.TRUE_STR)); 172 172 173 173 JPanel description_panel = new JPanel(); … … 273 273 public void gainFocus() { 274 274 // Retrieve all of the elements that are dependant on default language. 275 collection_extra_collectionmeta = CollectionDesignManager.collectionmeta_manager.getMetadatum( CollectionConfiguration.COLLECTIONMETADATA_COLLECTIONEXTRA_STR);276 collection_name_collectionmeta = CollectionDesignManager.collectionmeta_manager.getMetadatum( CollectionConfiguration.COLLECTIONMETADATA_COLLECTIONNAME_STR);275 collection_extra_collectionmeta = CollectionDesignManager.collectionmeta_manager.getMetadatum(StaticStrings.COLLECTIONMETADATA_COLLECTIONEXTRA_STR); 276 collection_name_collectionmeta = CollectionDesignManager.collectionmeta_manager.getMetadatum(StaticStrings.COLLECTIONMETADATA_COLLECTIONNAME_STR); 277 277 278 278 creator_collectionmeta = new CollectionMeta(CollectionDesignManager.collect_config.getCreator()); 279 icon_collection_collectionmeta = CollectionDesignManager.collectionmeta_manager.getMetadatum( CollectionConfiguration.COLLECTIONMETADATA_ICONCOLLECTION_STR);280 icon_collection_small_collectionmeta = CollectionDesignManager.collectionmeta_manager.getMetadatum( CollectionConfiguration.COLLECTIONMETADATA_ICONCOLLECTIONSMALL_STR);279 icon_collection_collectionmeta = CollectionDesignManager.collectionmeta_manager.getMetadatum(StaticStrings.COLLECTIONMETADATA_ICONCOLLECTION_STR); 280 icon_collection_small_collectionmeta = CollectionDesignManager.collectionmeta_manager.getMetadatum(StaticStrings.COLLECTIONMETADATA_ICONCOLLECTIONSMALL_STR); 281 281 maintainer_collectionmeta = new CollectionMeta(CollectionDesignManager.collect_config.getMaintainer()); 282 282 // Make sure the components are up to date … … 293 293 small_icon_textfield.setText(icon_collection_small_collectionmeta.getValue(CollectionMeta.TEXT)); 294 294 small_icon_textfield.setCaretPosition(0); 295 public_checkbox.setSelected(public_collectionmeta.getValue(CollectionMeta.TEXT).equals( CollectionConfiguration.TRUE_STR));295 public_checkbox.setSelected(public_collectionmeta.getValue(CollectionMeta.TEXT).equals(StaticStrings.TRUE_STR)); 296 296 ready = true; 297 297 } … … 302 302 if(ready) { 303 303 // Boolean values 304 public_collectionmeta.setValue((public_checkbox.isSelected() ? CollectionConfiguration.TRUE_STR : CollectionConfiguration.FALSE_STR));304 public_collectionmeta.setValue((public_checkbox.isSelected() ? StaticStrings.TRUE_STR : StaticStrings.FALSE_STR)); 305 305 String creator_email_str = creator_emailfield.getText(); 306 306 creator_collectionmeta.setValue(creator_email_str); -
trunk/gli/src/org/greenstone/gatherer/cdm/Index.java
r12304 r12641 43 43 implements Comparable, DOMProxyListEntry { 44 44 /** An values of items in the index level enumeration. */ 45 static protected final String LEVEL[] = { CollectionConfiguration.DOCUMENT_STR, CollectionConfiguration.SECTION_STR, CollectionConfiguration.PARAGRAPH_STR};45 static protected final String LEVEL[] = {StaticStrings.DOCUMENT_STR, StaticStrings.SECTION_STR, StaticStrings.PARAGRAPH_STR}; 46 46 47 47 private ArrayList sources = null; … … 67 67 // Create a new element 68 68 Document document = CollectionDesignManager.collect_config.document; 69 this.element = document.createElement( CollectionConfiguration.INDEX_ELEMENT);69 this.element = document.createElement(StaticStrings.INDEX_ELEMENT); 70 70 // For each source add a content element 71 71 int size = sources.size(); 72 72 for(int i = 0; i < size; i++) { 73 Element content_element = document.createElement( CollectionConfiguration.CONTENT_ELEMENT);73 Element content_element = document.createElement(StaticStrings.CONTENT_ELEMENT); 74 74 Object source_object = sources.get(i); 75 75 if (source_object instanceof MetadataElement) { 76 76 // System.err.println("Constructing new Index with MetadataElement source..."); 77 content_element.setAttribute( CollectionConfiguration.NAME_ATTRIBUTE, ((MetadataElement) source_object).getFullName());77 content_element.setAttribute(StaticStrings.NAME_ATTRIBUTE, ((MetadataElement) source_object).getFullName()); 78 78 } 79 79 else { 80 80 // System.err.println("Constructing new Index with String source..."); 81 content_element.setAttribute( CollectionConfiguration.NAME_ATTRIBUTE, source_object.toString());81 content_element.setAttribute(StaticStrings.NAME_ATTRIBUTE, source_object.toString()); 82 82 } 83 83 element.appendChild(content_element); … … 91 91 this(sources); 92 92 this.level = level; 93 element.setAttribute( CollectionConfiguration.LEVEL_ATTRIBUTE, LEVEL[level]);93 element.setAttribute(StaticStrings.LEVEL_ATTRIBUTE, LEVEL[level]); 94 94 } 95 95 … … 101 101 } 102 102 } 103 element.setAttribute( CollectionConfiguration.LEVEL_ATTRIBUTE, LEVEL[this.level]);103 element.setAttribute(StaticStrings.LEVEL_ATTRIBUTE, LEVEL[this.level]); 104 104 } 105 105 … … 138 138 public int getLevel() { 139 139 if(level == -1 && element != null) { 140 String level_str = element.getAttribute( CollectionConfiguration.LEVEL_ATTRIBUTE);140 String level_str = element.getAttribute(StaticStrings.LEVEL_ATTRIBUTE); 141 141 for(int i = 0; level == -1 && i < LEVEL.length; i++) { 142 142 if(level_str.equals(LEVEL[i])) { … … 197 197 if(sources == null) { 198 198 sources = new ArrayList(); 199 NodeList content_elements = element.getElementsByTagName( CollectionConfiguration.CONTENT_ELEMENT);199 NodeList content_elements = element.getElementsByTagName(StaticStrings.CONTENT_ELEMENT); 200 200 int content_elements_length = content_elements.getLength(); 201 201 for(int i = 0; i < content_elements_length; i++) { 202 202 Element content_element = (Element) content_elements.item(i); 203 String metadata_element_name_full = (String) content_element.getAttribute( CollectionConfiguration.NAME_ATTRIBUTE);203 String metadata_element_name_full = (String) content_element.getAttribute(StaticStrings.NAME_ATTRIBUTE); 204 204 MetadataElement metadata_element = MetadataTools.getMetadataElementWithName(metadata_element_name_full); 205 205 if (metadata_element != null) { … … 216 216 217 217 public boolean isAssigned() { 218 return (element != null && !element.getAttribute( CollectionConfiguration.ASSIGNED_ATTRIBUTE).equals(CollectionConfiguration.FALSE_STR));218 return (element != null && !element.getAttribute(StaticStrings.ASSIGNED_ATTRIBUTE).equals(StaticStrings.FALSE_STR)); 219 219 } 220 220 221 221 public void setAssigned(boolean assigned) { 222 222 if(element != null) { 223 element.setAttribute( CollectionConfiguration.ASSIGNED_ATTRIBUTE, (assigned ? CollectionConfiguration.TRUE_STR : CollectionConfiguration.FALSE_STR));223 element.setAttribute(StaticStrings.ASSIGNED_ATTRIBUTE, (assigned ? StaticStrings.TRUE_STR : StaticStrings.FALSE_STR)); 224 224 } 225 225 } … … 237 237 public void setLevel(int new_level) { 238 238 // System.err.println("SetLevel(" + new_level + ")"); 239 if(element != null && element.getNodeName().equals( CollectionConfiguration.INDEX_DEFAULT_ELEMENT)) {239 if(element != null && element.getNodeName().equals(StaticStrings.INDEX_DEFAULT_ELEMENT)) { 240 240 if (0 <= new_level && new_level < 3) { 241 element.setAttribute( CollectionConfiguration.LEVEL_ATTRIBUTE, LEVEL[new_level]);241 element.setAttribute(StaticStrings.LEVEL_ATTRIBUTE, LEVEL[new_level]); 242 242 } else { 243 element.setAttribute( CollectionConfiguration.LEVEL_ATTRIBUTE, "");243 element.setAttribute(StaticStrings.LEVEL_ATTRIBUTE, ""); 244 244 } 245 245 this.id = null; // Regenerate ID. … … 255 255 */ 256 256 public void setSources(ArrayList sources) { 257 if(element != null && element.getNodeName().equals( CollectionConfiguration.INDEX_DEFAULT_ELEMENT)) {257 if(element != null && element.getNodeName().equals(StaticStrings.INDEX_DEFAULT_ELEMENT)) { 258 258 // Erase old sources 259 259 XMLTools.clear(element); … … 261 261 int size = sources.size(); 262 262 for(int i = 0; i < size; i++) { 263 Element content_element = element.getOwnerDocument().createElement( CollectionConfiguration.CONTENT_ELEMENT);263 Element content_element = element.getOwnerDocument().createElement(StaticStrings.CONTENT_ELEMENT); 264 264 Object source_object = sources.get(i); 265 265 if (source_object instanceof MetadataElement) { 266 266 String name = ((MetadataElement) source_object).getFullName(); 267 content_element.setAttribute( CollectionConfiguration.NAME_ATTRIBUTE, name);267 content_element.setAttribute(StaticStrings.NAME_ATTRIBUTE, name); 268 268 name = null; 269 269 } 270 270 else { 271 271 //DebugStream.println("Found String as source: " + source_object.toString()); 272 content_element.setAttribute( CollectionConfiguration.NAME_ATTRIBUTE, source_object.toString());272 content_element.setAttribute(StaticStrings.NAME_ATTRIBUTE, source_object.toString()); 273 273 } 274 274 source_object = null; -
trunk/gli/src/org/greenstone/gatherer/cdm/IndexManager.java
r12469 r12641 69 69 public IndexManager(Element indexes, String current_build_type) { 70 70 71 super(indexes, CollectionConfiguration.INDEX_ELEMENT, new Index());71 super(indexes, StaticStrings.INDEX_ELEMENT, new Index()); 72 72 DebugStream.println("IndexManager: " + getSize() + " indexes parsed."); 73 73 index_model = this; … … 75 75 76 76 // Parse and retrieve the default index 77 NodeList default_index_elements = CollectionDesignManager.collect_config.getDocumentElement().getElementsByTagName( CollectionConfiguration.INDEX_DEFAULT_ELEMENT);77 NodeList default_index_elements = CollectionDesignManager.collect_config.getDocumentElement().getElementsByTagName(StaticStrings.INDEX_DEFAULT_ELEMENT); 78 78 if(default_index_elements.getLength() > 0) { 79 79 … … 139 139 // Retrieve and assign MG element and default index element 140 140 Element mg_element = CollectionDesignManager.collect_config.getMGIndexes(); 141 mg_element.setAttribute( CollectionConfiguration.ASSIGNED_ATTRIBUTE, CollectionConfiguration.TRUE_STR);142 NodeList indexes = mg_element.getElementsByTagName( CollectionConfiguration.INDEX_ELEMENT);141 mg_element.setAttribute(StaticStrings.ASSIGNED_ATTRIBUTE, StaticStrings.TRUE_STR); 142 NodeList indexes = mg_element.getElementsByTagName(StaticStrings.INDEX_ELEMENT); 143 143 if(indexes.getLength() != 0) { 144 144 //just reinstate what we had previously … … 146 146 } else { 147 147 // If mg element has no indexes, and the current mgpp index includes a text one, then generate text indexes for each of the registered levels. 148 Index index = getIndex( CollectionConfiguration.TEXT_STR);148 Index index = getIndex(StaticStrings.TEXT_STR); 149 149 if(index != null) { 150 150 // Replace mgpp element with mg element … … 157 157 // Try to retrieve existing metadatum 158 158 String source_str = new_index.getID(); 159 CollectionMeta metadatum = CollectionDesignManager.collectionmeta_manager.getMetadatum( CollectionConfiguration.STOP_CHARACTER + source_str, false);159 CollectionMeta metadatum = CollectionDesignManager.collectionmeta_manager.getMetadatum(StaticStrings.STOP_CHARACTER + source_str, false); 160 160 // If no metadata was found, add new pseudo metadata using the id 161 161 if(metadatum == null) { 162 metadatum = new CollectionMeta( CollectionConfiguration.STOP_CHARACTER + source_str);162 metadatum = new CollectionMeta(StaticStrings.STOP_CHARACTER + source_str); 163 163 metadatum.setAssigned(true); 164 164 metadatum.setValue(source_str); … … 177 177 178 178 // Unassign mgpp element 179 mgpp_element.setAttribute( CollectionConfiguration.ASSIGNED_ATTRIBUTE, CollectionConfiguration.FALSE_STR);179 mgpp_element.setAttribute(StaticStrings.ASSIGNED_ATTRIBUTE, StaticStrings.FALSE_STR); 180 180 mgpp_element = null; 181 181 … … 186 186 // Retrieve and assign the MGPP indexes element. 187 187 Element mgpp_element = CollectionDesignManager.collect_config.getMGPPIndexes(); 188 mgpp_element.setAttribute( CollectionConfiguration.ASSIGNED_ATTRIBUTE, CollectionConfiguration.TRUE_STR);189 NodeList indexes = mgpp_element.getElementsByTagName( CollectionConfiguration.INDEX_ELEMENT);188 mgpp_element.setAttribute(StaticStrings.ASSIGNED_ATTRIBUTE, StaticStrings.TRUE_STR); 189 NodeList indexes = mgpp_element.getElementsByTagName(StaticStrings.INDEX_ELEMENT); 190 190 if(indexes.getLength() != 0) { 191 191 // we just reinstate the indexes we had before the change … … 228 228 // Try to retrieve existing metadatum 229 229 source_str = new_index.getID(); 230 CollectionMeta metadatum = CollectionDesignManager.collectionmeta_manager.getMetadatum( CollectionConfiguration.STOP_CHARACTER + source_str, false);230 CollectionMeta metadatum = CollectionDesignManager.collectionmeta_manager.getMetadatum(StaticStrings.STOP_CHARACTER + source_str, false); 231 231 // If no metadata was found, add new pseudo metadata using the id 232 232 if(metadatum == null) { 233 metadatum = new CollectionMeta( CollectionConfiguration.STOP_CHARACTER + source_str);233 metadatum = new CollectionMeta(StaticStrings.STOP_CHARACTER + source_str); 234 234 metadatum.setAssigned(true); 235 235 metadatum.setValue(source_str); … … 250 250 251 251 // Unassign MG element 252 mg_element.setAttribute( CollectionConfiguration.ASSIGNED_ATTRIBUTE, CollectionConfiguration.FALSE_STR);252 mg_element.setAttribute(StaticStrings.ASSIGNED_ATTRIBUTE, StaticStrings.FALSE_STR); 253 253 mg_element = null; 254 254 … … 346 346 if(index != null) { 347 347 // Remove any current metadata from this index 348 CollectionDesignManager.collectionmeta_manager.removeMetadata( CollectionConfiguration.STOP_CHARACTER + index.getID());348 CollectionDesignManager.collectionmeta_manager.removeMetadata(StaticStrings.STOP_CHARACTER + index.getID()); 349 349 // Remove the index 350 350 remove(index); … … 378 378 } 379 379 // Remove the old index coll meta 380 CollectionDesignManager.collectionmeta_manager.removeMetadata( CollectionConfiguration.STOP_CHARACTER + old_index.getID());380 CollectionDesignManager.collectionmeta_manager.removeMetadata(StaticStrings.STOP_CHARACTER + old_index.getID()); 381 381 // Add the new coll meta 382 382 CollectionDesignManager.collectionmeta_manager.addMetadatum(coll_meta); … … 403 403 if(default_index == null) { 404 404 // Create the default index element, and place immediately after indexes element. 405 Element default_index_element = root.getOwnerDocument().createElement( CollectionConfiguration.INDEX_DEFAULT_ELEMENT);405 Element default_index_element = root.getOwnerDocument().createElement(StaticStrings.INDEX_DEFAULT_ELEMENT); 406 406 default_index = new Index(default_index_element); 407 407 Node target_node = CollectionConfiguration.findInsertionPoint(default_index_element); … … 777 777 // Note the order of these must be the same as the 778 778 // level order in Index 779 level_combobox.addItem( CollectionConfiguration.DOCUMENT_STR);//Dictionary.get("CDM.IndexManager.Document"));780 level_combobox.addItem( CollectionConfiguration.SECTION_STR);//Dictionary.get("CDM.IndexManager.Section"));781 level_combobox.addItem( CollectionConfiguration.PARAGRAPH_STR);//Dictionary.get("CDM.IndexManager.Paragraph"));779 level_combobox.addItem(StaticStrings.DOCUMENT_STR);//Dictionary.get("CDM.IndexManager.Document")); 780 level_combobox.addItem(StaticStrings.SECTION_STR);//Dictionary.get("CDM.IndexManager.Section")); 781 level_combobox.addItem(StaticStrings.PARAGRAPH_STR);//Dictionary.get("CDM.IndexManager.Paragraph")); 782 782 level_combobox.setEditable(false); 783 783 level_combobox.setToolTipText(Dictionary.get("CDM.IndexManager.Level_Tooltip")); … … 803 803 source_list.setTickedObjects(sources.toArray()); 804 804 source_list.setEnabled(true); 805 if (sources.contains( CollectionConfiguration.TEXT_STR)) {805 if (sources.contains(StaticStrings.TEXT_STR)) { 806 806 text_checkbox.setSelected(true); 807 807 } … … 850 850 sources = source_list.getTicked(); 851 851 if (text_checkbox.isSelected()) { 852 sources.add(0, CollectionConfiguration.TEXT_STR);852 sources.add(0, StaticStrings.TEXT_STR); 853 853 } 854 854 if (mgpp_enabled) { … … 887 887 ArrayList sources = source_list.getTicked(); 888 888 if (text_checkbox.isSelected()) { 889 sources.add(0, CollectionConfiguration.TEXT_STR);889 sources.add(0, StaticStrings.TEXT_STR); 890 890 } 891 891 if(mgpp_enabled) { … … 899 899 900 900 // Before we add the index to the model, we have to add a default collection metadata for this 901 CollectionMeta metadatum = new CollectionMeta( CollectionConfiguration.STOP_CHARACTER + index.getID());901 CollectionMeta metadatum = new CollectionMeta(StaticStrings.STOP_CHARACTER + index.getID()); 902 902 metadatum.setValue(index.getID()); 903 903 … … 915 915 public void actionPerformed(ActionEvent event) { 916 916 ArrayList all_sources = source_list.getAll(); 917 all_sources.add(0, CollectionConfiguration.TEXT_STR);917 all_sources.add(0, StaticStrings.TEXT_STR); 918 918 ArrayList new_sources = new ArrayList(); 919 919 for(int i = 0; i < all_sources.size(); i++) { … … 931 931 } 932 932 // Create new metadatum 933 CollectionMeta metadatum = new CollectionMeta( CollectionConfiguration.STOP_CHARACTER + index.getID());933 CollectionMeta metadatum = new CollectionMeta(StaticStrings.STOP_CHARACTER + index.getID()); 934 934 metadatum.setValue(name); 935 935 name = null; … … 982 982 sources = source_list.getTicked(); 983 983 if (text_checkbox.isSelected()) { 984 sources.add(0, CollectionConfiguration.TEXT_STR);984 sources.add(0, StaticStrings.TEXT_STR); 985 985 } 986 986 if (mgpp_enabled) { … … 992 992 if (index != null) { 993 993 // Create the new collection meta 994 CollectionMeta metadatum = new CollectionMeta( CollectionConfiguration.STOP_CHARACTER + index.getID());994 CollectionMeta metadatum = new CollectionMeta(StaticStrings.STOP_CHARACTER + index.getID()); 995 995 metadatum.setValue(index.getID()); 996 996 -
trunk/gli/src/org/greenstone/gatherer/cdm/Language.java
r12277 r12641 28 28 29 29 import java.util.ArrayList; 30 import org.greenstone.gatherer.util.StaticStrings; 30 31 import org.w3c.dom.*; 32 31 33 32 34 /** A pretty unexciting extension of a two character string, in that it has a field which details if its the default language. … … 54 56 this.code = code; 55 57 // Create the new element 56 element = CollectionDesignManager.collect_config.document.createElement( CollectionConfiguration.LANGUAGE_ELEMENT);57 element.setAttribute( CollectionConfiguration.NAME_ATTRIBUTE, code);58 element.setAttribute( CollectionConfiguration.ASSIGNED_ATTRIBUTE, CollectionConfiguration.TRUE_STR);58 element = CollectionDesignManager.collect_config.document.createElement(StaticStrings.LANGUAGE_ELEMENT); 59 element.setAttribute(StaticStrings.NAME_ATTRIBUTE, code); 60 element.setAttribute(StaticStrings.ASSIGNED_ATTRIBUTE, StaticStrings.TRUE_STR); 59 61 } 60 62 … … 72 74 } 73 75 this.code = code_str.toString(); 74 element = CollectionDesignManager.collect_config.document.createElement( CollectionConfiguration.LANGUAGE_ELEMENT);75 element.setAttribute( CollectionConfiguration.NAME_ATTRIBUTE, code);76 element.setAttribute( CollectionConfiguration.ASSIGNED_ATTRIBUTE, CollectionConfiguration.TRUE_STR);76 element = CollectionDesignManager.collect_config.document.createElement(StaticStrings.LANGUAGE_ELEMENT); 77 element.setAttribute(StaticStrings.NAME_ATTRIBUTE, code); 78 element.setAttribute(StaticStrings.ASSIGNED_ATTRIBUTE, StaticStrings.TRUE_STR); 77 79 78 80 } … … 109 111 public String getCode() { 110 112 if(code == null && element != null) { 111 code = element.getAttribute( CollectionConfiguration.NAME_ATTRIBUTE);113 code = element.getAttribute(StaticStrings.NAME_ATTRIBUTE); 112 114 } 113 115 return code; … … 138 140 139 141 public boolean isAssigned() { 140 return (element != null && element.getAttribute( CollectionConfiguration.ASSIGNED_ATTRIBUTE).equals(CollectionConfiguration.TRUE_STR));142 return (element != null && element.getAttribute(StaticStrings.ASSIGNED_ATTRIBUTE).equals(StaticStrings.TRUE_STR)); 141 143 } 142 144 143 145 public void setAssigned(boolean value) { 144 146 if(element != null) { 145 element.setAttribute( CollectionConfiguration.ASSIGNED_ATTRIBUTE, (value ? CollectionConfiguration.TRUE_STR : CollectionConfiguration.FALSE_STR));147 element.setAttribute(StaticStrings.ASSIGNED_ATTRIBUTE, (value ? StaticStrings.TRUE_STR : StaticStrings.FALSE_STR)); 146 148 } 147 149 } … … 151 153 // Set element 152 154 if(element != null) { 153 element.setAttribute( CollectionConfiguration.NAME_ATTRIBUTE, new_code);155 element.setAttribute(StaticStrings.NAME_ATTRIBUTE, new_code); 154 156 } 155 157 // Reset name -
trunk/gli/src/org/greenstone/gatherer/cdm/LanguageManager.java
r12349 r12641 45 45 import org.greenstone.gatherer.util.CheckListEntry; 46 46 import org.greenstone.gatherer.util.JarTools; 47 import org.greenstone.gatherer.util.StaticStrings; 47 48 import org.greenstone.gatherer.util.XMLTools; 48 49 import org.w3c.dom.*; … … 72 73 /** Constructor. */ 73 74 public LanguageManager(Element languages_element) { 74 super(languages_element, CollectionConfiguration.LANGUAGE_ELEMENT, new Language());75 super(languages_element, StaticStrings.LANGUAGE_ELEMENT, new Language()); 75 76 76 77 DebugStream.println("LanguageManager: " + getSize() + " languages parsed."); … … 78 79 this.model = this; 79 80 // Retrieve the default language 80 NodeList default_language_elements = CollectionDesignManager.collect_config.getDocumentElement().getElementsByTagName( CollectionConfiguration.LANGUAGE_DEFAULT_ELEMENT);81 NodeList default_language_elements = CollectionDesignManager.collect_config.getDocumentElement().getElementsByTagName(StaticStrings.LANGUAGE_DEFAULT_ELEMENT); 81 82 if(default_language_elements.getLength() > 0) { 82 83 default_language = new Language((Element)default_language_elements.item(0)); … … 87 88 // Load a series of code->language mappings into known_languages, by reading from the 'languages.xml' file, which is essentially a subset of the ISO 639 Standard. 88 89 known_languages = new LinkedHashMap(); 89 NodeList language_elements = LANGUAGES_DOCUMENT.getDocumentElement().getElementsByTagName( CollectionConfiguration.LANGUAGE_ELEMENT);90 NodeList language_elements = LANGUAGES_DOCUMENT.getDocumentElement().getElementsByTagName(StaticStrings.LANGUAGE_ELEMENT); 90 91 for(int i = 0; i < language_elements.getLength(); i++) { 91 92 Element language_element = (Element) language_elements.item(i); 92 String code = language_element.getAttribute( CollectionConfiguration.CODE_ATTRIBUTE);93 String name = language_element.getAttribute( CollectionConfiguration.NAME_ATTRIBUTE);93 String code = language_element.getAttribute(StaticStrings.CODE_ATTRIBUTE); 94 String name = language_element.getAttribute(StaticStrings.NAME_ATTRIBUTE); 94 95 known_languages.put(code.toLowerCase(), name); 95 96 name = null; … … 107 108 if(!contains(language)) { 108 109 // need to add a pseudo metadata 109 CollectionMeta metadatum = new CollectionMeta( CollectionConfiguration.STOP_CHARACTER + language.getCode());110 CollectionMeta metadatum = new CollectionMeta(StaticStrings.STOP_CHARACTER + language.getCode()); 110 111 metadatum.setValue(language.getName()); 111 112 CollectionDesignManager.collectionmeta_manager.addMetadatum(metadatum); … … 216 217 remove(language); 217 218 // Remove any collection metadata for this language 218 CollectionDesignManager.collectionmeta_manager.removeMetadata( CollectionConfiguration.STOP_CHARACTER + language.getCode());219 CollectionDesignManager.collectionmeta_manager.removeMetadata(StaticStrings.STOP_CHARACTER + language.getCode()); 219 220 if(default_language != null && default_language.equals(language)) { 220 221 setDefault(null); … … 225 226 private void replaceLanguage(Language old_language, Language new_language) { 226 227 // Remove old lang collection meta 227 CollectionDesignManager.collectionmeta_manager.removeMetadata( CollectionConfiguration.STOP_CHARACTER + old_language.getCode());228 CollectionDesignManager.collectionmeta_manager.removeMetadata(StaticStrings.STOP_CHARACTER + old_language.getCode()); 228 229 // Add new one 229 CollectionMeta metadatum = new CollectionMeta( CollectionConfiguration.STOP_CHARACTER + new_language.getCode());230 CollectionMeta metadatum = new CollectionMeta(StaticStrings.STOP_CHARACTER + new_language.getCode()); 230 231 metadatum.setValue(new_language.getName()); 231 232 CollectionDesignManager.collectionmeta_manager.addMetadatum(metadatum); … … 252 253 if(default_language == null) { 253 254 // Create the default index element, and place immediately after indexes element. 254 Element default_language_element = root.getOwnerDocument().createElement( CollectionConfiguration.LANGUAGE_DEFAULT_ELEMENT);255 Element default_language_element = root.getOwnerDocument().createElement(StaticStrings.LANGUAGE_DEFAULT_ELEMENT); 255 256 default_language = new Language(default_language_element); 256 257 Node target_node = CollectionConfiguration.findInsertionPoint(default_language_element); -
trunk/gli/src/org/greenstone/gatherer/cdm/Level.java
r12075 r12641 27 27 package org.greenstone.gatherer.cdm; 28 28 29 /************************************************************************************** 30 * Written: 16/07/03 31 * Revised: 32 **************************************************************************************/ 29 import org.greenstone.gatherer.util.StaticStrings; 33 30 import org.w3c.dom.*; 31 34 32 35 33 /** This class represents a level (for mgpp and lucene collecitons) . … … 56 54 */ 57 55 public Level(String level) { 58 this.element = CollectionDesignManager.collect_config.document.createElement( CollectionConfiguration.LEVEL_ELEMENT);59 this.element.setAttribute( CollectionConfiguration.NAME_ATTRIBUTE, level);56 this.element = CollectionDesignManager.collect_config.document.createElement(StaticStrings.LEVEL_ELEMENT); 57 this.element.setAttribute(StaticStrings.NAME_ATTRIBUTE, level); 60 58 } 61 59 … … 100 98 */ 101 99 public String getLevel() { 102 return element.getAttribute( CollectionConfiguration.NAME_ATTRIBUTE);100 return element.getAttribute(StaticStrings.NAME_ATTRIBUTE); 103 101 } 104 102 105 103 /** Determine is this command has been assigned, either because it already existed in the collection configuration, or because it has been explicitly set by the user. Non-assigned entries imply they have been added by the GLI to ensure consistancy (and avoid NPE's!) 106 104 * @return true if this command has been assigned, false otherwise 107 * @see org.greenstone.gatherer.cdm.CollectionConfiguration108 105 */ 109 106 public boolean isAssigned() { 110 return (element != null && !element.getAttribute( CollectionConfiguration.ASSIGNED_ATTRIBUTE).equals(CollectionConfiguration.FALSE_STR));107 return (element != null && !element.getAttribute(StaticStrings.ASSIGNED_ATTRIBUTE).equals(StaticStrings.FALSE_STR)); 111 108 } 112 109 113 110 /** Set the assigned state. 114 111 * @param assigned the desired state of assigned as a boolean 115 * @see org.greenstone.gatherer.cdm.CollectionConfiguration116 112 */ 117 113 public void setAssigned(boolean assigned) { 118 114 if(element != null) { 119 element.setAttribute( CollectionConfiguration.ASSIGNED_ATTRIBUTE, (assigned ? CollectionConfiguration.TRUE_STR : CollectionConfiguration.FALSE_STR));115 element.setAttribute(StaticStrings.ASSIGNED_ATTRIBUTE, (assigned ? StaticStrings.TRUE_STR : StaticStrings.FALSE_STR)); 120 116 } 121 117 } … … 130 126 /** Set the name of this level. 131 127 * @param name the new name for this level, as a String 132 * @see org.greenstone.gatherer.cdm.CollectionConfiguration133 128 */ 134 129 public void setLevel(String level) { 135 130 if(element != null) { 136 element.setAttribute( CollectionConfiguration.NAME_ATTRIBUTE, level);131 element.setAttribute(StaticStrings.NAME_ATTRIBUTE, level); 137 132 } 138 133 } … … 140 135 /** Produce a text representation of this level. 141 136 * @return a String showing this level 142 * @see org.greenstone.gatherer.cdm.CollectionConfiguration143 137 */ 144 138 public String toString() { -
trunk/gli/src/org/greenstone/gatherer/cdm/LevelManager.java
r12413 r12641 11 11 import org.greenstone.gatherer.Gatherer; 12 12 import org.greenstone.gatherer.util.JarTools; 13 import org.greenstone.gatherer.util.StaticStrings; 13 14 import org.w3c.dom.*; 15 16 14 17 public class LevelManager 15 18 extends DOMProxyListModel … … 24 27 25 28 public LevelManager(Element levels, String current_build_type) { 26 super(levels, CollectionConfiguration.LEVEL_ELEMENT, new Level());29 super(levels, StaticStrings.LEVEL_ELEMENT, new Level()); 27 30 DebugStream.println("LevelManager: " + getSize() + " levels parsed."); 28 31 … … 33 36 } 34 37 // Parse and retrieve the default level 35 NodeList default_level_elements = CollectionDesignManager.collect_config.getDocumentElement().getElementsByTagName( CollectionConfiguration.LEVEL_DEFAULT_ELEMENT);38 NodeList default_level_elements = CollectionDesignManager.collect_config.getDocumentElement().getElementsByTagName(StaticStrings.LEVEL_DEFAULT_ELEMENT); 36 39 if(default_level_elements.getLength() > 0) { 37 40 default_level = new Level((Element)default_level_elements.item(0)); … … 46 49 int position = 0; 47 50 48 if (level.equals( CollectionConfiguration.SECTION_STR) && getSize()==1) {51 if (level.equals(StaticStrings.SECTION_STR) && getSize()==1) { 49 52 position = 1; 50 53 } 51 54 add(position, new Level(level)); 52 55 // add in a default collection meta 53 CollectionMeta meta = new CollectionMeta( CollectionConfiguration.STOP_CHARACTER + level);56 CollectionMeta meta = new CollectionMeta(StaticStrings.STOP_CHARACTER + level); 54 57 meta.setAssigned(true); 55 58 meta.setValue(level); … … 102 105 private void removeLevel(String level_name) { 103 106 // Remove any current metadata from this level 104 CollectionDesignManager.collectionmeta_manager.removeMetadata( CollectionConfiguration.STOP_CHARACTER + level_name);107 CollectionDesignManager.collectionmeta_manager.removeMetadata(StaticStrings.STOP_CHARACTER + level_name); 105 108 // Remove the level 106 109 Level level_elem = null; … … 120 123 if(default_level == null) { 121 124 // Create the default level element, and place immediately after leveles element. 122 Element default_level_element = root.getOwnerDocument().createElement( CollectionConfiguration.LEVEL_DEFAULT_ELEMENT);125 Element default_level_element = root.getOwnerDocument().createElement(StaticStrings.LEVEL_DEFAULT_ELEMENT); 123 126 default_level = new Level(default_level_element); 124 127 Node target_node = CollectionConfiguration.findInsertionPoint(default_level_element); … … 162 165 document_default_radio.setBackground(Configuration.getColor("coloring.collection_tree_background", false)); 163 166 document_default_radio.setOpaque(false); 164 document_default_radio.setActionCommand( CollectionConfiguration.DOCUMENT_STR);167 document_default_radio.setActionCommand(StaticStrings.DOCUMENT_STR); 165 168 document_default_radio.setIcon(JarTools.getImage("radio_unselected.gif")); 166 169 document_default_radio.setSelectedIcon(JarTools.getImage("radio_selected.gif")); … … 175 178 section_default_radio.setSelectedIcon(JarTools.getImage("radio_selected.gif")); 176 179 177 section_default_radio.setActionCommand( CollectionConfiguration.SECTION_STR);180 section_default_radio.setActionCommand(StaticStrings.SECTION_STR); 178 181 ButtonGroup default_group = new ButtonGroup(); 179 182 default_group.add(document_default_radio); … … 185 188 // no levels yet, set document 186 189 document_checkbox.setSelected(true); 187 addLevel( CollectionConfiguration.DOCUMENT_STR);190 addLevel(StaticStrings.DOCUMENT_STR); 188 191 } else { 189 if (getLevel( CollectionConfiguration.DOCUMENT_STR)!= null) {192 if (getLevel(StaticStrings.DOCUMENT_STR)!= null) { 190 193 document_checkbox.setSelected(true); 191 194 } 192 if (getLevel( CollectionConfiguration.SECTION_STR) != null) {195 if (getLevel(StaticStrings.SECTION_STR) != null) { 193 196 section_checkbox.setSelected(true); 194 197 } … … 197 200 if (default_level != null && default_level.isAssigned()) { 198 201 // set the default based on specified default 199 if (default_level.getLevel().equals( CollectionConfiguration.DOCUMENT_STR) && document_checkbox.isSelected()) {202 if (default_level.getLevel().equals(StaticStrings.DOCUMENT_STR) && document_checkbox.isSelected()) { 200 203 document_default_radio.setSelected(true); 201 } else if (default_level.getLevel().equals( CollectionConfiguration.SECTION_STR) && section_checkbox.isSelected()) {204 } else if (default_level.getLevel().equals(StaticStrings.SECTION_STR) && section_checkbox.isSelected()) { 202 205 section_default_radio.setSelected(true); 203 206 } else { … … 208 211 // if have no valid specified default 209 212 if (default_level == null || !default_level.isAssigned()) { 210 String default_l = CollectionConfiguration.DOCUMENT_STR;213 String default_l = StaticStrings.DOCUMENT_STR; 211 214 if (document_checkbox.isSelected()) { 212 215 document_default_radio.setSelected(true); 213 default_l = CollectionConfiguration.DOCUMENT_STR;216 default_l = StaticStrings.DOCUMENT_STR; 214 217 } else if (section_checkbox.isSelected()) { 215 218 section_default_radio.setSelected(true); 216 default_l = CollectionConfiguration.SECTION_STR;219 default_l = StaticStrings.SECTION_STR; 217 220 } 218 221 setDefault(default_l); … … 311 314 if (!document_enabled && document_default_radio.isSelected()) { 312 315 section_default_radio.setSelected(true); 313 setDefault( CollectionConfiguration.SECTION_STR);316 setDefault(StaticStrings.SECTION_STR); 314 317 315 318 } else if (!section_enabled && section_default_radio.isSelected()) { 316 319 document_default_radio.setSelected(true); 317 setDefault( CollectionConfiguration.DOCUMENT_STR);320 setDefault(StaticStrings.DOCUMENT_STR); 318 321 } 319 322 -
trunk/gli/src/org/greenstone/gatherer/cdm/PluginManager.java
r12638 r12641 75 75 */ 76 76 public PluginManager() { 77 super(CollectionDesignManager.collect_config.getDocumentElement(), CollectionConfiguration.PLUGIN_ELEMENT, new Plugin());77 super(CollectionDesignManager.collect_config.getDocumentElement(), StaticStrings.PLUGIN_ELEMENT, new Plugin()); 78 78 DebugStream.println("PluginManager: " + super.getSize() + " plugins parsed."); 79 79 model = this; … … 275 275 } 276 276 else if (node_name.equals("Abstract")) { 277 plugin.setIsAbstract(XMLTools.getValue(node).equalsIgnoreCase( CollectionConfiguration.YES_STR));277 plugin.setIsAbstract(XMLTools.getValue(node).equalsIgnoreCase(StaticStrings.YES_STR)); 278 278 } 279 279 else if (node_name.equalsIgnoreCase("Explodes")) { … … 524 524 } 525 525 } 526 Element element = CollectionDesignManager.collect_config.document.createElement( CollectionConfiguration.PLUGIN_ELEMENT);527 element.setAttribute( CollectionConfiguration.TYPE_ATTRIBUTE, CollectionConfiguration.SEPARATOR_ATTRIBUTE);528 element.setAttribute( CollectionConfiguration.SEPARATOR_ATTRIBUTE, CollectionConfiguration.TRUE_STR);526 Element element = CollectionDesignManager.collect_config.document.createElement(StaticStrings.PLUGIN_ELEMENT); 527 element.setAttribute(StaticStrings.TYPE_ATTRIBUTE, StaticStrings.SEPARATOR_ATTRIBUTE); 528 element.setAttribute(StaticStrings.SEPARATOR_ATTRIBUTE, StaticStrings.TRUE_STR); 529 529 separator_plugin = new Plugin(element, null); 530 530 ///atherer.println("Adding plugin separator at: " + separator_index); … … 770 770 771 771 // Create a new element in the DOM 772 Element new_plugin_element = CollectionDesignManager.collect_config.document.createElement( CollectionConfiguration.PLUGIN_ELEMENT);773 new_plugin_element.setAttribute( CollectionConfiguration.TYPE_ATTRIBUTE, plugin.getName());772 Element new_plugin_element = CollectionDesignManager.collect_config.document.createElement(StaticStrings.PLUGIN_ELEMENT); 773 new_plugin_element.setAttribute(StaticStrings.TYPE_ATTRIBUTE, plugin.getName()); 774 774 Plugin new_plugin = new Plugin(new_plugin_element, plugin); 775 775 … … 1137 1137 1138 1138 // Create a new element in the DOM 1139 Element new_plugin_element = CollectionDesignManager.collect_config.document.createElement( CollectionConfiguration.PLUGIN_ELEMENT);1140 new_plugin_element.setAttribute( CollectionConfiguration.TYPE_ATTRIBUTE, plugin.getName());1139 Element new_plugin_element = CollectionDesignManager.collect_config.document.createElement(StaticStrings.PLUGIN_ELEMENT); 1140 new_plugin_element.setAttribute(StaticStrings.TYPE_ATTRIBUTE, plugin.getName()); 1141 1141 Plugin new_plugin = new Plugin(new_plugin_element, plugin); 1142 1142 -
trunk/gli/src/org/greenstone/gatherer/cdm/SearchMetadataManager.java
r12299 r12641 34 34 import org.greenstone.gatherer.Dictionary; 35 35 import org.greenstone.gatherer.gui.DesignPaneHeader; 36 import org.greenstone.gatherer.util.StaticStrings; 37 36 38 37 39 public class SearchMetadataManager … … 180 182 181 183 public String getMetaID() { 182 return CollectionConfiguration.STOP_CHARACTER+id;184 return StaticStrings.STOP_CHARACTER+id; 183 185 } 184 186 public String getValue() { -
trunk/gli/src/org/greenstone/gatherer/cdm/Subcollection.java
r12282 r12641 170 170 171 171 public boolean isAssigned() { 172 return (element != null && !element.getAttribute( CollectionConfiguration.ASSIGNED_ATTRIBUTE).equals(CollectionConfiguration.FALSE_STR));172 return (element != null && !element.getAttribute(StaticStrings.ASSIGNED_ATTRIBUTE).equals(StaticStrings.FALSE_STR)); 173 173 } 174 174 … … 186 186 public void setAssigned(boolean assigned) { 187 187 if(element != null) { 188 element.setAttribute( CollectionConfiguration.ASSIGNED_ATTRIBUTE, (assigned ? CollectionConfiguration.TRUE_STR : CollectionConfiguration.FALSE_STR));188 element.setAttribute(StaticStrings.ASSIGNED_ATTRIBUTE, (assigned ? StaticStrings.TRUE_STR : StaticStrings.FALSE_STR)); 189 189 } 190 190 } -
trunk/gli/src/org/greenstone/gatherer/cdm/SubcollectionIndex.java
r12090 r12641 28 28 29 29 import java.util.*; 30 import org.greenstone.gatherer.DebugStream;31 30 import org.greenstone.gatherer.util.StaticStrings; 32 31 import org.greenstone.gatherer.util.XMLTools; … … 59 58 // Create a new element 60 59 Document document = CollectionDesignManager.collect_config.document; 61 element = document.createElement( CollectionConfiguration.INDEX_ELEMENT);60 element = document.createElement(StaticStrings.INDEX_ELEMENT); 62 61 // For each source add a content element 63 62 int size = raw_sources.length; … … 66 65 String subcollection_name = subcollection.getName(); 67 66 sources.add(subcollection_name); 68 Element content_element = document.createElement( CollectionConfiguration.CONTENT_ELEMENT);69 content_element.setAttribute( CollectionConfiguration.NAME_ATTRIBUTE, subcollection_name);67 Element content_element = document.createElement(StaticStrings.CONTENT_ELEMENT); 68 content_element.setAttribute(StaticStrings.NAME_ATTRIBUTE, subcollection_name); 70 69 element.appendChild(content_element); 71 70 content_element = null; … … 121 120 if(sources == null) { 122 121 sources = new ArrayList(); 123 NodeList content_elements = element.getElementsByTagName( CollectionConfiguration.CONTENT_ELEMENT);122 NodeList content_elements = element.getElementsByTagName(StaticStrings.CONTENT_ELEMENT); 124 123 int content_elements_length = content_elements.getLength(); 125 124 for(int i = 0; i < content_elements_length; i++) { 126 125 Element content_element = (Element) content_elements.item(i); 127 sources.add(content_element.getAttribute( CollectionConfiguration.NAME_ATTRIBUTE));126 sources.add(content_element.getAttribute(StaticStrings.NAME_ATTRIBUTE)); 128 127 } 129 128 content_elements = null; … … 134 133 135 134 public boolean isAssigned() { 136 return (element != null && !element.getAttribute( CollectionConfiguration.ASSIGNED_ATTRIBUTE).equals(CollectionConfiguration.FALSE_STR));135 return (element != null && !element.getAttribute(StaticStrings.ASSIGNED_ATTRIBUTE).equals(StaticStrings.FALSE_STR)); 137 136 } 138 137 139 138 public void setAssigned(boolean assigned) { 140 139 if(element != null) { 141 element.setAttribute( CollectionConfiguration.ASSIGNED_ATTRIBUTE, (assigned ? CollectionConfiguration.TRUE_STR : CollectionConfiguration.FALSE_STR));140 element.setAttribute(StaticStrings.ASSIGNED_ATTRIBUTE, (assigned ? StaticStrings.TRUE_STR : StaticStrings.FALSE_STR)); 142 141 } 143 142 } … … 159 158 int size = sources.size(); 160 159 for(int i = 0; i < size; i++) { 161 Element content_element = element.getOwnerDocument().createElement( CollectionConfiguration.CONTENT_ELEMENT);162 content_element.setAttribute( CollectionConfiguration.NAME_ATTRIBUTE, (String) sources.get(i));160 Element content_element = element.getOwnerDocument().createElement(StaticStrings.CONTENT_ELEMENT); 161 content_element.setAttribute(StaticStrings.NAME_ATTRIBUTE, (String) sources.get(i)); 163 162 element.appendChild(content_element); 164 163 content_element = null; -
trunk/gli/src/org/greenstone/gatherer/cdm/SubcollectionIndexManager.java
r12283 r12641 38 38 import org.greenstone.gatherer.util.CheckList; 39 39 import org.greenstone.gatherer.util.JarTools; 40 import org.greenstone.gatherer.util.StaticStrings; 40 41 import org.w3c.dom.*; 41 42 … … 58 59 public SubcollectionIndexManager(Element subindexes) 59 60 { 60 super(subindexes, CollectionConfiguration.INDEX_ELEMENT, new SubcollectionIndex());61 super(subindexes, StaticStrings.INDEX_ELEMENT, new SubcollectionIndex()); 61 62 DebugStream.println("SubcollectionIndexManager: " + getSize() + " subcollection indexes parsed."); 62 63 this.model = this; 63 64 64 65 // Parse and retrieve the default index 65 NodeList default_index_elements = CollectionDesignManager.collect_config.getDocumentElement().getElementsByTagName( CollectionConfiguration.SUBCOLLECTION_DEFAULT_INDEX_ELEMENT);66 NodeList default_index_elements = CollectionDesignManager.collect_config.getDocumentElement().getElementsByTagName(StaticStrings.SUBCOLLECTION_DEFAULT_INDEX_ELEMENT); 66 67 if (default_index_elements.getLength() > 0) { 67 68 default_index = new SubcollectionIndex((Element) default_index_elements.item(0)); … … 79 80 if (!contains(subcollection_index)) { 80 81 // add a pseudo metadata 81 CollectionMeta metadatum = new CollectionMeta( CollectionConfiguration.STOP_CHARACTER + subcollection_index.getID());82 CollectionMeta metadatum = new CollectionMeta(StaticStrings.STOP_CHARACTER + subcollection_index.getID()); 82 83 metadatum.setValue(subcollection_index.getID()); 83 84 CollectionDesignManager.collectionmeta_manager.addMetadatum(metadatum); … … 164 165 if (subcollection_index != null) { 165 166 // Remove any current metadata from this index 166 CollectionDesignManager.collectionmeta_manager.removeMetadata( CollectionConfiguration.STOP_CHARACTER + subcollection_index.getID());167 CollectionDesignManager.collectionmeta_manager.removeMetadata(StaticStrings.STOP_CHARACTER + subcollection_index.getID()); 167 168 168 169 // Check if the index removed happens to be the default index … … 197 198 private void replaceSubcollectionIndex(SubcollectionIndex old_subcollection, SubcollectionIndex new_subcollection) { 198 199 // Remove old collection meta 199 CollectionDesignManager.collectionmeta_manager.removeMetadata( CollectionConfiguration.STOP_CHARACTER + old_subcollection.getID());200 CollectionDesignManager.collectionmeta_manager.removeMetadata(StaticStrings.STOP_CHARACTER + old_subcollection.getID()); 200 201 // Add new one 201 CollectionMeta metadatum = new CollectionMeta( CollectionConfiguration.STOP_CHARACTER + new_subcollection.getID());202 CollectionMeta metadatum = new CollectionMeta(StaticStrings.STOP_CHARACTER + new_subcollection.getID()); 202 203 metadatum.setValue(new_subcollection.getID()); 203 204 CollectionDesignManager.collectionmeta_manager.addMetadatum(metadatum); … … 227 228 if (default_index == null) { 228 229 // Create the default index element, and place immediately after indexes element. 229 Element default_index_element = root.getOwnerDocument().createElement( CollectionConfiguration.SUBCOLLECTION_DEFAULT_INDEX_ELEMENT);230 Element default_index_element = root.getOwnerDocument().createElement(StaticStrings.SUBCOLLECTION_DEFAULT_INDEX_ELEMENT); 230 231 default_index = new SubcollectionIndex(default_index_element); 231 232 Node target_node = CollectionConfiguration.findInsertionPoint(default_index_element); -
trunk/gli/src/org/greenstone/gatherer/cdm/SuperCollection.java
r8243 r12641 27 27 package org.greenstone.gatherer.cdm; 28 28 29 /************************************************************************************** 30 * Written: 02/07/03 31 * Revised: 32 **************************************************************************************/ 29 import org.greenstone.gatherer.util.StaticStrings; 33 30 import org.w3c.dom.Element; 31 34 32 35 33 public class SuperCollection … … 67 65 public String getName() { 68 66 if(name == null && element != null) { 69 name = element.getAttribute( CollectionConfiguration.NAME_ATTRIBUTE);67 name = element.getAttribute(StaticStrings.NAME_ATTRIBUTE); 70 68 } 71 69 return name; … … 73 71 74 72 public boolean isAssigned() { 75 return (element != null && element.getAttribute( CollectionConfiguration.ASSIGNED_ATTRIBUTE).equals(CollectionConfiguration.TRUE_STR));73 return (element != null && element.getAttribute(StaticStrings.ASSIGNED_ATTRIBUTE).equals(StaticStrings.TRUE_STR)); 76 74 } 77 75 78 76 public void setAssigned(boolean assigned) { 79 77 if(element != null) { 80 element.setAttribute( CollectionConfiguration.ASSIGNED_ATTRIBUTE, (assigned ? CollectionConfiguration.TRUE_STR : CollectionConfiguration.FALSE_STR));78 element.setAttribute(StaticStrings.ASSIGNED_ATTRIBUTE, (assigned ? StaticStrings.TRUE_STR : StaticStrings.FALSE_STR)); 81 79 } 82 80 } … … 90 88 this.name = name; 91 89 if(element != null) { 92 element.setAttribute( CollectionConfiguration.NAME_ATTRIBUTE, name);90 element.setAttribute(StaticStrings.NAME_ATTRIBUTE, name); 93 91 } 94 92 } -
trunk/gli/src/org/greenstone/gatherer/cdm/TranslationView.java
r12123 r12641 39 39 import org.greenstone.gatherer.gui.DesignPaneHeader; 40 40 import org.greenstone.gatherer.gui.GLIButton; 41 import org.greenstone.gatherer.util.StaticStrings; 42 41 43 42 44 /** This class provides a graphical interface to allow a user to quickly and conviently (ie all in one place) translate the text fragments associated with general metadata and indexes into each of the assigned languages in the collection. It should provide clear controls for the editing of these text fragments, plus clear indicate what languages still need further translation, which it will do through a combination of coloring and other visual indicators. … … 147 149 public String getName() { 148 150 if(content instanceof Index) { 149 return CollectionConfiguration.STOP_CHARACTER + ((Index)content).getID();151 return StaticStrings.STOP_CHARACTER + ((Index)content).getID(); 150 152 } 151 153 else if (content instanceof SubcollectionIndex) { 152 return CollectionConfiguration.STOP_CHARACTER + ((SubcollectionIndex)content).getID();154 return StaticStrings.STOP_CHARACTER + ((SubcollectionIndex)content).getID(); 153 155 } 154 156 else { … … 160 162 if(text == null) { 161 163 String temp = content.toString(); 162 if(temp.indexOf( CollectionConfiguration.SPACE_CHARACTER) != -1) {163 temp = temp.substring(0, temp.indexOf( CollectionConfiguration.SPACE_CHARACTER));164 if(temp.indexOf(StaticStrings.SPACE_CHARACTER) != -1) { 165 temp = temp.substring(0, temp.indexOf(StaticStrings.SPACE_CHARACTER)); 164 166 } 165 167 if(content instanceof Index) { -
trunk/gli/src/org/greenstone/gatherer/download/Download.java
r12529 r12641 202 202 203 203 public boolean isAssigned() { 204 return (element != null && !element.getAttribute( CollectionConfiguration.ASSIGNED_ATTRIBUTE).equals(CollectionConfiguration.FALSE_STR));204 return (element != null && !element.getAttribute(StaticStrings.ASSIGNED_ATTRIBUTE).equals(StaticStrings.FALSE_STR)); 205 205 } 206 206 207 207 public void setAssigned(boolean assigned) { 208 208 if(element != null) { 209 element.setAttribute( CollectionConfiguration.ASSIGNED_ATTRIBUTE, (assigned ? CollectionConfiguration.TRUE_STR : CollectionConfiguration.FALSE_STR));209 element.setAttribute(StaticStrings.ASSIGNED_ATTRIBUTE, (assigned ? StaticStrings.TRUE_STR : StaticStrings.FALSE_STR)); 210 210 } 211 211 }
Note:
See TracChangeset
for help on using the changeset viewer.