Changeset 12641


Ignore:
Timestamp:
2006-09-01T11:38:53+12:00 (18 years ago)
Author:
mdewsnip
Message:

Changed all access to the static strings through CollectionConfiguration to directly use StaticStrings.

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  
    3737import org.w3c.dom.*;
    3838
    39 /**************************************************************************************
    40  * Written:      20/05/02
    41  * Revised:      03/07/03
    42  **************************************************************************************/
    43 import java.util.ArrayList;
    4439
    4540/** This class provides an interface to any class that contains a list of Arguments.
     
    228223
    229224    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));
    231226    }
    232227
    233228    public void setAssigned(boolean assigned) {
    234229    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));
    236231    }
    237232    }
  • trunk/gli/src/org/greenstone/gatherer/cdm/ClassifierManager.java

    r12638 r12641  
    7272     */
    7373    public ClassifierManager() {
    74     super(CollectionDesignManager.collect_config.getDocumentElement(), CollectionConfiguration.CLASSIFY_ELEMENT, new Classifier());
     74    super(CollectionDesignManager.collect_config.getDocumentElement(), StaticStrings.CLASSIFY_ELEMENT, new Classifier());
    7575    this.model = this;
    7676    DebugStream.println("ClassifierManager: " + getSize() + " classifiers parsed.");
     
    232232        }
    233233        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));
    235235        }
    236236        // Parse the classifier arguments
     
    598598
    599599        // 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());
    602602        Classifier new_classifier = new Classifier(new_classifier_element, classifier);
    603603
  • trunk/gli/src/org/greenstone/gatherer/cdm/CollectionMeta.java

    r11870 r12641  
    133133
    134134    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));
    136136    }
    137137
     
    149149    public void setAssigned(boolean assigned) {
    150150    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));
    152152    }
    153153    }
  • trunk/gli/src/org/greenstone/gatherer/cdm/DOMProxyListModel.java

    r12414 r12641  
    3030import javax.swing.*;
    3131import org.greenstone.gatherer.DebugStream;
     32import org.greenstone.gatherer.util.StaticStrings;
    3233import org.w3c.dom.*;
    3334
     
    273274    public synchronized void setAssigned(boolean assigned) {
    274275    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);
    279280    }
    280281    }
    281282
    282283    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));
    284285    }
    285286}
  • trunk/gli/src/org/greenstone/gatherer/cdm/Format.java

    r12301 r12641  
    2929import org.greenstone.gatherer.DebugStream;
    3030import org.greenstone.gatherer.util.Codec;
     31import org.greenstone.gatherer.util.StaticStrings;
    3132import org.greenstone.gatherer.util.XMLTools;
    3233import org.w3c.dom.*;
     
    126127    public Format(Object feature, String part, boolean state) {
    127128
    128     element = CollectionDesignManager.collect_config.document.createElement(CollectionConfiguration.FORMAT_ELEMENT);
     129    element = CollectionDesignManager.collect_config.document.createElement(StaticStrings.FORMAT_ELEMENT);
    129130    setName(feature, part);
    130131    setState(state);
     
    139140    public Format(Object feature, String part, String value) {
    140141
    141     element = CollectionDesignManager.collect_config.document.createElement(CollectionConfiguration.FORMAT_ELEMENT);       
     142    element = CollectionDesignManager.collect_config.document.createElement(StaticStrings.FORMAT_ELEMENT);       
    142143    setName(feature, part);
    143144    setValue(value);
     
    156157    }
    157158    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());
    159160    }
    160161    return toString().compareTo(object.toString());
     
    203204    public String getFeatureName() {
    204205    if (feature_name == null) {
    205         String name  = element.getAttribute(CollectionConfiguration.NAME_ATTRIBUTE);
     206        String name  = element.getAttribute(StaticStrings.NAME_ATTRIBUTE);
    206207        // Remove part
    207208        String part = getPart();
     
    221222    public String getName() {
    222223    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);
    225226    }
    226227    return "Error";
     
    233234    if(part == null && element != null) {
    234235        // 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);
    236237        // DEFAULT_PARTS[0] is an empty string to correctly enable comboboxes.
    237238        name = name.toLowerCase();
     
    252253     */
    253254    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));
    255256    }
    256257
     
    269270
    270271    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));
    272273    }
    273274
    274275    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);
    276277    }
    277278
    278279    public void setAssigned(boolean assigned) {
    279280    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));
    281282    }
    282283    }
     
    298299        classifier = (Classifier) feature;
    299300        feature_name = classifier.getPositionString();
    300         element.setAttribute(CollectionConfiguration.NAME_ATTRIBUTE, classifier.getPositionString() + part);
     301        element.setAttribute(StaticStrings.NAME_ATTRIBUTE, classifier.getPositionString() + part);
    301302        }
    302303        else {
     
    307308            feature_name = feature.toString();
    308309        }
    309         element.setAttribute(CollectionConfiguration.NAME_ATTRIBUTE, feature_name + part);
     310        element.setAttribute(StaticStrings.NAME_ATTRIBUTE, feature_name + part);
    310311        }
    311312        text = null;
     
    318319    public void setState(boolean state) {
    319320    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));
    321322        text = null;
    322323    }
     
    329330    if(element != null) {
    330331        // 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)) {
    332333        value = value.substring(1, value.length() - 1);
    333334        }
     
    346347    if(text == null && element != null) {
    347348        StringBuffer temp = new StringBuffer(" ");
    348         temp.append(element.getAttribute(CollectionConfiguration.NAME_ATTRIBUTE));
     349        temp.append(element.getAttribute(StaticStrings.NAME_ATTRIBUTE));
    349350        temp.append(" ");
    350         String value = element.getAttribute(CollectionConfiguration.VALUE_ATTRIBUTE);
     351        String value = element.getAttribute(StaticStrings.VALUE_ATTRIBUTE);
    351352        if(value.length() > 0) {
    352353        temp.append(value);
     
    354355        else {
    355356        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)) {
    357358            temp.append(value);
    358359        }
     
    373374    public void update() {
    374375    if(classifier != null) {
    375         element.setAttribute(CollectionConfiguration.NAME_ATTRIBUTE, classifier.getPositionString() + getPart());
     376        element.setAttribute(StaticStrings.NAME_ATTRIBUTE, classifier.getPositionString() + getPart());
    376377        feature_name = classifier.getPositionString();
    377378        text = null;
  • trunk/gli/src/org/greenstone/gatherer/cdm/FormatManager.java

    r12449 r12641  
    8585    /** Constructor. */
    8686    public FormatManager() {
    87     super(CollectionDesignManager.collect_config.getDocumentElement(), CollectionConfiguration.FORMAT_ELEMENT, new Format());
     87    super(CollectionDesignManager.collect_config.getDocumentElement(), StaticStrings.FORMAT_ELEMENT, new Format());
    8888    this.model = this;
    8989
  • trunk/gli/src/org/greenstone/gatherer/cdm/GeneralManager.java

    r12123 r12641  
    169169        // public
    170170        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));
    172172       
    173173        JPanel description_panel = new JPanel();
     
    273273    public void gainFocus() {
    274274        // 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);
    277277       
    278278        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);
    281281        maintainer_collectionmeta = new CollectionMeta(CollectionDesignManager.collect_config.getMaintainer());
    282282        // Make sure the components are up to date
     
    293293        small_icon_textfield.setText(icon_collection_small_collectionmeta.getValue(CollectionMeta.TEXT));
    294294        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));
    296296        ready = true;
    297297    }
     
    302302        if(ready) {
    303303        // 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));
    305305        String creator_email_str = creator_emailfield.getText();
    306306        creator_collectionmeta.setValue(creator_email_str);
  • trunk/gli/src/org/greenstone/gatherer/cdm/Index.java

    r12304 r12641  
    4343    implements Comparable, DOMProxyListEntry {
    4444    /** 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};
    4646
    4747    private ArrayList sources = null;
     
    6767    // Create a new element
    6868    Document document = CollectionDesignManager.collect_config.document;
    69     this.element = document.createElement(CollectionConfiguration.INDEX_ELEMENT);
     69    this.element = document.createElement(StaticStrings.INDEX_ELEMENT);
    7070    // For each source add a content element
    7171    int size = sources.size();
    7272    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);
    7474        Object source_object = sources.get(i);
    7575        if (source_object instanceof MetadataElement) {
    7676        // 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());
    7878        }
    7979        else {
    8080        // 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());
    8282        }
    8383        element.appendChild(content_element);
     
    9191    this(sources);
    9292    this.level = level;
    93     element.setAttribute(CollectionConfiguration.LEVEL_ATTRIBUTE, LEVEL[level]);
     93    element.setAttribute(StaticStrings.LEVEL_ATTRIBUTE, LEVEL[level]);
    9494    }
    9595
     
    101101        }
    102102    }
    103     element.setAttribute(CollectionConfiguration.LEVEL_ATTRIBUTE, LEVEL[this.level]);
     103    element.setAttribute(StaticStrings.LEVEL_ATTRIBUTE, LEVEL[this.level]);
    104104    }
    105105
     
    138138    public int getLevel() {
    139139    if(level == -1 && element != null) {
    140         String level_str = element.getAttribute(CollectionConfiguration.LEVEL_ATTRIBUTE);
     140        String level_str = element.getAttribute(StaticStrings.LEVEL_ATTRIBUTE);
    141141        for(int i = 0; level == -1 && i < LEVEL.length; i++) {
    142142        if(level_str.equals(LEVEL[i])) {
     
    197197    if(sources == null) {
    198198        sources = new ArrayList();
    199         NodeList content_elements = element.getElementsByTagName(CollectionConfiguration.CONTENT_ELEMENT);
     199        NodeList content_elements = element.getElementsByTagName(StaticStrings.CONTENT_ELEMENT);
    200200        int content_elements_length = content_elements.getLength();
    201201        for(int i = 0; i < content_elements_length; i++) {
    202202        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);
    204204        MetadataElement metadata_element = MetadataTools.getMetadataElementWithName(metadata_element_name_full);
    205205        if (metadata_element != null) {
     
    216216
    217217    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));
    219219    }
    220220
    221221    public void setAssigned(boolean assigned) {
    222222    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));
    224224    }
    225225    }
     
    237237    public void setLevel(int new_level) {
    238238    // 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)) {
    240240        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]);
    242242        } else {
    243         element.setAttribute(CollectionConfiguration.LEVEL_ATTRIBUTE, "");
     243        element.setAttribute(StaticStrings.LEVEL_ATTRIBUTE, "");
    244244        }
    245245        this.id = null; // Regenerate ID.
     
    255255     */
    256256    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)) {
    258258        // Erase old sources
    259259        XMLTools.clear(element);
     
    261261        int size = sources.size();
    262262        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);
    264264        Object source_object = sources.get(i);
    265265        if (source_object instanceof MetadataElement) {
    266266            String name = ((MetadataElement) source_object).getFullName();
    267             content_element.setAttribute(CollectionConfiguration.NAME_ATTRIBUTE, name);
     267            content_element.setAttribute(StaticStrings.NAME_ATTRIBUTE, name);
    268268            name = null;
    269269        }
    270270        else {
    271271            //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());
    273273        }
    274274        source_object = null;
  • trunk/gli/src/org/greenstone/gatherer/cdm/IndexManager.java

    r12469 r12641  
    6969    public IndexManager(Element indexes, String current_build_type) {
    7070
    71     super(indexes, CollectionConfiguration.INDEX_ELEMENT, new Index());
     71    super(indexes, StaticStrings.INDEX_ELEMENT, new Index());
    7272    DebugStream.println("IndexManager: " + getSize() + " indexes parsed.");
    7373    index_model = this;
     
    7575       
    7676    // 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);
    7878    if(default_index_elements.getLength() > 0) {
    7979                 
     
    139139    // Retrieve and assign MG element and default index element
    140140    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);
    143143    if(indexes.getLength() != 0) {
    144144        //just reinstate what we had previously
     
    146146    } else {
    147147        // 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);
    149149        if(index != null) {
    150150        // Replace mgpp element with mg element
     
    157157            // Try to retrieve existing metadatum
    158158            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);
    160160            // If no metadata was found, add new pseudo metadata using the id
    161161            if(metadatum == null) {
    162             metadatum = new CollectionMeta(CollectionConfiguration.STOP_CHARACTER + source_str);
     162            metadatum = new CollectionMeta(StaticStrings.STOP_CHARACTER + source_str);
    163163            metadatum.setAssigned(true);
    164164            metadatum.setValue(source_str);
     
    177177   
    178178    // Unassign mgpp element
    179     mgpp_element.setAttribute(CollectionConfiguration.ASSIGNED_ATTRIBUTE, CollectionConfiguration.FALSE_STR);
     179    mgpp_element.setAttribute(StaticStrings.ASSIGNED_ATTRIBUTE, StaticStrings.FALSE_STR);
    180180    mgpp_element = null;
    181181   
     
    186186    // Retrieve and assign the MGPP indexes element.
    187187    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);
    190190    if(indexes.getLength() != 0) {
    191191        // we just reinstate the indexes we had before the change
     
    228228        // Try to retrieve existing metadatum
    229229        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);
    231231        // If no metadata was found, add new pseudo metadata using the id
    232232        if(metadatum == null) {
    233             metadatum = new CollectionMeta(CollectionConfiguration.STOP_CHARACTER + source_str);
     233            metadatum = new CollectionMeta(StaticStrings.STOP_CHARACTER + source_str);
    234234            metadatum.setAssigned(true);
    235235            metadatum.setValue(source_str);
     
    250250
    251251    // Unassign MG element
    252     mg_element.setAttribute(CollectionConfiguration.ASSIGNED_ATTRIBUTE, CollectionConfiguration.FALSE_STR);
     252    mg_element.setAttribute(StaticStrings.ASSIGNED_ATTRIBUTE, StaticStrings.FALSE_STR);
    253253    mg_element = null;
    254254   
     
    346346    if(index != null) {
    347347        // 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());
    349349        // Remove the index
    350350        remove(index);
     
    378378    }
    379379    // 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());
    381381    // Add the new coll meta
    382382    CollectionDesignManager.collectionmeta_manager.addMetadatum(coll_meta);
     
    403403        if(default_index == null) {
    404404        // 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);               
    406406        default_index = new Index(default_index_element);
    407407        Node target_node = CollectionConfiguration.findInsertionPoint(default_index_element);
     
    777777            // Note the order of these must be the same as the
    778778            // 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"));
    782782            level_combobox.setEditable(false);
    783783            level_combobox.setToolTipText(Dictionary.get("CDM.IndexManager.Level_Tooltip"));
     
    803803            source_list.setTickedObjects(sources.toArray());
    804804            source_list.setEnabled(true);
    805             if (sources.contains(CollectionConfiguration.TEXT_STR)) {
     805            if (sources.contains(StaticStrings.TEXT_STR)) {
    806806                text_checkbox.setSelected(true);
    807807            }
     
    850850            sources = source_list.getTicked();
    851851            if (text_checkbox.isSelected()) {
    852             sources.add(0, CollectionConfiguration.TEXT_STR);
     852            sources.add(0, StaticStrings.TEXT_STR);
    853853            }           
    854854            if (mgpp_enabled) {
     
    887887            ArrayList sources = source_list.getTicked();
    888888            if (text_checkbox.isSelected()) {
    889                 sources.add(0, CollectionConfiguration.TEXT_STR);
     889                sources.add(0, StaticStrings.TEXT_STR);
    890890            }
    891891            if(mgpp_enabled) {
     
    899899         
    900900            // 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());
    902902            metadatum.setValue(index.getID());
    903903       
     
    915915        public void actionPerformed(ActionEvent event) {
    916916            ArrayList all_sources = source_list.getAll();
    917             all_sources.add(0, CollectionConfiguration.TEXT_STR);
     917            all_sources.add(0, StaticStrings.TEXT_STR);
    918918            ArrayList new_sources = new ArrayList();
    919919            for(int i = 0; i < all_sources.size(); i++) {
     
    931931                }
    932932                // Create new metadatum
    933                 CollectionMeta metadatum = new CollectionMeta(CollectionConfiguration.STOP_CHARACTER + index.getID());
     933                CollectionMeta metadatum = new CollectionMeta(StaticStrings.STOP_CHARACTER + index.getID());
    934934                metadatum.setValue(name);
    935935                name = null;
     
    982982            sources = source_list.getTicked();
    983983            if (text_checkbox.isSelected()) {
    984                 sources.add(0, CollectionConfiguration.TEXT_STR);
     984                sources.add(0, StaticStrings.TEXT_STR);
    985985            }
    986986            if (mgpp_enabled) {
     
    992992            if (index != null) {
    993993            // 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());
    995995            metadatum.setValue(index.getID());
    996996           
  • trunk/gli/src/org/greenstone/gatherer/cdm/Language.java

    r12277 r12641  
    2828
    2929import java.util.ArrayList;
     30import org.greenstone.gatherer.util.StaticStrings;
    3031import org.w3c.dom.*;
     32
    3133
    3234/** A pretty unexciting extension of a two character string, in that it has a field which details if its the default language.
     
    5456    this.code = code;
    5557    // 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);
    5961    }
    6062
     
    7274    }
    7375    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);
    7779   
    7880    }
     
    109111    public String getCode() {
    110112    if(code == null && element != null) {
    111         code = element.getAttribute(CollectionConfiguration.NAME_ATTRIBUTE);
     113        code = element.getAttribute(StaticStrings.NAME_ATTRIBUTE);
    112114    }
    113115    return code;
     
    138140
    139141    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));
    141143    }
    142144
    143145    public void setAssigned(boolean value) {
    144146    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));
    146148    }
    147149    }
     
    151153    // Set element
    152154    if(element != null) {
    153         element.setAttribute(CollectionConfiguration.NAME_ATTRIBUTE, new_code);
     155        element.setAttribute(StaticStrings.NAME_ATTRIBUTE, new_code);
    154156    }
    155157    // Reset name
  • trunk/gli/src/org/greenstone/gatherer/cdm/LanguageManager.java

    r12349 r12641  
    4545import org.greenstone.gatherer.util.CheckListEntry;
    4646import org.greenstone.gatherer.util.JarTools;
     47import org.greenstone.gatherer.util.StaticStrings;
    4748import org.greenstone.gatherer.util.XMLTools;
    4849import org.w3c.dom.*;
     
    7273   /** Constructor. */
    7374    public LanguageManager(Element languages_element) {
    74     super(languages_element, CollectionConfiguration.LANGUAGE_ELEMENT, new Language());
     75    super(languages_element, StaticStrings.LANGUAGE_ELEMENT, new Language());
    7576   
    7677    DebugStream.println("LanguageManager: " + getSize() + " languages parsed.");
     
    7879    this.model = this;
    7980    // 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);
    8182    if(default_language_elements.getLength() > 0) {
    8283        default_language = new Language((Element)default_language_elements.item(0));
     
    8788    // 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.
    8889    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);
    9091    for(int i = 0; i < language_elements.getLength(); i++) {
    9192        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);
    9495        known_languages.put(code.toLowerCase(), name);
    9596        name = null;
     
    107108    if(!contains(language)) {
    108109        // 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());
    110111        metadatum.setValue(language.getName());
    111112        CollectionDesignManager.collectionmeta_manager.addMetadatum(metadatum);
     
    216217    remove(language);
    217218    // 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());
    219220    if(default_language != null && default_language.equals(language)) {
    220221        setDefault(null);
     
    225226    private void replaceLanguage(Language old_language, Language new_language) {
    226227    // 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());
    228229    // 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());
    230231    metadatum.setValue(new_language.getName());
    231232    CollectionDesignManager.collectionmeta_manager.addMetadatum(metadatum);
     
    252253        if(default_language == null) {
    253254        // 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);
    255256        default_language = new Language(default_language_element);
    256257        Node target_node = CollectionConfiguration.findInsertionPoint(default_language_element);
  • trunk/gli/src/org/greenstone/gatherer/cdm/Level.java

    r12075 r12641  
    2727package org.greenstone.gatherer.cdm;
    2828
    29 /**************************************************************************************
    30  * Written:      16/07/03
    31  * Revised:     
    32  **************************************************************************************/
     29import org.greenstone.gatherer.util.StaticStrings;
    3330import org.w3c.dom.*;
     31
    3432
    3533/** This class represents a level (for mgpp and lucene collecitons) .
     
    5654     */
    5755    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);
    6058    }
    6159
     
    10098     */
    10199    public String getLevel() {
    102     return element.getAttribute(CollectionConfiguration.NAME_ATTRIBUTE);
     100    return element.getAttribute(StaticStrings.NAME_ATTRIBUTE);
    103101    }
    104102   
    105103   /** 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!)
    106104     * @return true if this command has been assigned, false otherwise
    107      * @see org.greenstone.gatherer.cdm.CollectionConfiguration
    108105     */
    109106    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));
    111108    }
    112109   
    113110    /** Set the assigned state.
    114111     * @param  assigned the desired state of assigned as a boolean
    115      * @see org.greenstone.gatherer.cdm.CollectionConfiguration
    116112     */
    117113    public void setAssigned(boolean assigned) {
    118114    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));
    120116    }
    121117    }
     
    130126    /** Set the name of this level.
    131127     * @param  name the new name for this level, as a String
    132      * @see org.greenstone.gatherer.cdm.CollectionConfiguration
    133128     */
    134129    public void setLevel(String level) {
    135130    if(element != null) {
    136         element.setAttribute(CollectionConfiguration.NAME_ATTRIBUTE, level);
     131        element.setAttribute(StaticStrings.NAME_ATTRIBUTE, level);
    137132    }
    138133    }
     
    140135    /** Produce a text representation of this level.
    141136     * @return a String showing this level
    142      * @see org.greenstone.gatherer.cdm.CollectionConfiguration
    143137     */
    144138    public String toString() {
  • trunk/gli/src/org/greenstone/gatherer/cdm/LevelManager.java

    r12413 r12641  
    1111import org.greenstone.gatherer.Gatherer;
    1212import org.greenstone.gatherer.util.JarTools;
     13import org.greenstone.gatherer.util.StaticStrings;
    1314import org.w3c.dom.*;
     15
     16
    1417public class LevelManager
    1518    extends DOMProxyListModel
     
    2427   
    2528    public LevelManager(Element levels, String current_build_type) {
    26     super(levels, CollectionConfiguration.LEVEL_ELEMENT, new Level());
     29    super(levels, StaticStrings.LEVEL_ELEMENT, new Level());
    2730    DebugStream.println("LevelManager: " + getSize() + " levels parsed.");
    2831   
     
    3336    }
    3437    // 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);
    3639    if(default_level_elements.getLength() > 0) {
    3740        default_level = new Level((Element)default_level_elements.item(0));
     
    4649        int position = 0;
    4750       
    48         if (level.equals(CollectionConfiguration.SECTION_STR) && getSize()==1) {
     51        if (level.equals(StaticStrings.SECTION_STR) && getSize()==1) {
    4952        position = 1;
    5053        }
    5154        add(position, new Level(level));
    5255        // add in a default collection meta
    53         CollectionMeta meta = new CollectionMeta(CollectionConfiguration.STOP_CHARACTER + level);
     56        CollectionMeta meta = new CollectionMeta(StaticStrings.STOP_CHARACTER + level);
    5457        meta.setAssigned(true);
    5558        meta.setValue(level);
     
    102105    private void removeLevel(String level_name) {
    103106    // 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);
    105108    // Remove the level
    106109    Level level_elem = null;
     
    120123        if(default_level == null) {
    121124        // 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);
    123126        default_level = new Level(default_level_element);
    124127        Node target_node = CollectionConfiguration.findInsertionPoint(default_level_element);
     
    162165        document_default_radio.setBackground(Configuration.getColor("coloring.collection_tree_background", false));
    163166        document_default_radio.setOpaque(false);
    164         document_default_radio.setActionCommand(CollectionConfiguration.DOCUMENT_STR);
     167        document_default_radio.setActionCommand(StaticStrings.DOCUMENT_STR);
    165168        document_default_radio.setIcon(JarTools.getImage("radio_unselected.gif"));
    166169        document_default_radio.setSelectedIcon(JarTools.getImage("radio_selected.gif"));
     
    175178        section_default_radio.setSelectedIcon(JarTools.getImage("radio_selected.gif"));
    176179
    177         section_default_radio.setActionCommand(CollectionConfiguration.SECTION_STR);
     180        section_default_radio.setActionCommand(StaticStrings.SECTION_STR);
    178181        ButtonGroup default_group = new ButtonGroup();
    179182        default_group.add(document_default_radio);
     
    185188        // no levels yet, set document
    186189        document_checkbox.setSelected(true);
    187         addLevel(CollectionConfiguration.DOCUMENT_STR);
     190        addLevel(StaticStrings.DOCUMENT_STR);
    188191        } else {
    189         if (getLevel(CollectionConfiguration.DOCUMENT_STR)!= null) {
     192        if (getLevel(StaticStrings.DOCUMENT_STR)!= null) {
    190193            document_checkbox.setSelected(true);
    191194        }
    192         if (getLevel(CollectionConfiguration.SECTION_STR) != null) {
     195        if (getLevel(StaticStrings.SECTION_STR) != null) {
    193196            section_checkbox.setSelected(true);
    194197        }
     
    197200        if (default_level != null && default_level.isAssigned()) {
    198201        // 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()) {
    200203            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()) {
    202205            section_default_radio.setSelected(true);
    203206        } else {
     
    208211        // if have no valid specified default
    209212        if (default_level == null || !default_level.isAssigned()) {
    210         String default_l = CollectionConfiguration.DOCUMENT_STR;
     213        String default_l = StaticStrings.DOCUMENT_STR;
    211214        if (document_checkbox.isSelected()) {
    212215            document_default_radio.setSelected(true);
    213             default_l = CollectionConfiguration.DOCUMENT_STR;
     216            default_l = StaticStrings.DOCUMENT_STR;
    214217        } else if (section_checkbox.isSelected()) {
    215218            section_default_radio.setSelected(true);
    216             default_l = CollectionConfiguration.SECTION_STR;
     219            default_l = StaticStrings.SECTION_STR;
    217220        }
    218221        setDefault(default_l);
     
    311314        if (!document_enabled && document_default_radio.isSelected()) {
    312315        section_default_radio.setSelected(true);
    313         setDefault(CollectionConfiguration.SECTION_STR);
     316        setDefault(StaticStrings.SECTION_STR);
    314317               
    315318        } else if (!section_enabled && section_default_radio.isSelected()) {
    316319        document_default_radio.setSelected(true);
    317         setDefault(CollectionConfiguration.DOCUMENT_STR);
     320        setDefault(StaticStrings.DOCUMENT_STR);
    318321        }
    319322
  • trunk/gli/src/org/greenstone/gatherer/cdm/PluginManager.java

    r12638 r12641  
    7575     */
    7676    public PluginManager() {
    77     super(CollectionDesignManager.collect_config.getDocumentElement(), CollectionConfiguration.PLUGIN_ELEMENT, new Plugin());
     77    super(CollectionDesignManager.collect_config.getDocumentElement(), StaticStrings.PLUGIN_ELEMENT, new Plugin());
    7878    DebugStream.println("PluginManager: " + super.getSize() + " plugins parsed.");
    7979    model = this;
     
    275275        }
    276276        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));
    278278        }
    279279        else if (node_name.equalsIgnoreCase("Explodes")) {
     
    524524        }
    525525    }
    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);
    529529    separator_plugin = new Plugin(element, null);
    530530    ///atherer.println("Adding plugin separator at: " + separator_index);
     
    770770
    771771        // 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());
    774774        Plugin new_plugin = new Plugin(new_plugin_element, plugin);
    775775
     
    11371137
    11381138        // 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());
    11411141        Plugin new_plugin = new Plugin(new_plugin_element, plugin);
    11421142
  • trunk/gli/src/org/greenstone/gatherer/cdm/SearchMetadataManager.java

    r12299 r12641  
    3434import org.greenstone.gatherer.Dictionary;
    3535import org.greenstone.gatherer.gui.DesignPaneHeader;
     36import org.greenstone.gatherer.util.StaticStrings;
     37
    3638
    3739public class SearchMetadataManager
     
    180182   
    181183    public String getMetaID() {
    182         return CollectionConfiguration.STOP_CHARACTER+id;
     184        return StaticStrings.STOP_CHARACTER+id;
    183185    }
    184186    public String getValue() {
  • trunk/gli/src/org/greenstone/gatherer/cdm/Subcollection.java

    r12282 r12641  
    170170
    171171    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));
    173173    }
    174174
     
    186186    public void setAssigned(boolean assigned) {
    187187    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));
    189189    }
    190190    }
  • trunk/gli/src/org/greenstone/gatherer/cdm/SubcollectionIndex.java

    r12090 r12641  
    2828
    2929import java.util.*;
    30 import org.greenstone.gatherer.DebugStream;
    3130import org.greenstone.gatherer.util.StaticStrings;
    3231import org.greenstone.gatherer.util.XMLTools;
     
    5958    // Create a new element
    6059    Document document = CollectionDesignManager.collect_config.document;
    61     element = document.createElement(CollectionConfiguration.INDEX_ELEMENT);
     60    element = document.createElement(StaticStrings.INDEX_ELEMENT);
    6261    // For each source add a content element
    6362    int size = raw_sources.length;
     
    6665        String subcollection_name = subcollection.getName();
    6766        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);
    7069        element.appendChild(content_element);
    7170        content_element = null;
     
    121120    if(sources == null) {
    122121        sources = new ArrayList();
    123         NodeList content_elements = element.getElementsByTagName(CollectionConfiguration.CONTENT_ELEMENT);
     122        NodeList content_elements = element.getElementsByTagName(StaticStrings.CONTENT_ELEMENT);
    124123        int content_elements_length = content_elements.getLength();
    125124        for(int i = 0; i < content_elements_length; i++) {
    126125        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));
    128127        }
    129128        content_elements = null;
     
    134133
    135134    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));
    137136    }
    138137
    139138    public void setAssigned(boolean assigned) {
    140139    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));
    142141    }
    143142    }
     
    159158        int size = sources.size();
    160159        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));
    163162        element.appendChild(content_element);
    164163        content_element = null;
  • trunk/gli/src/org/greenstone/gatherer/cdm/SubcollectionIndexManager.java

    r12283 r12641  
    3838import org.greenstone.gatherer.util.CheckList;
    3939import org.greenstone.gatherer.util.JarTools;
     40import org.greenstone.gatherer.util.StaticStrings;
    4041import org.w3c.dom.*;
    4142
     
    5859    public SubcollectionIndexManager(Element subindexes)
    5960    {
    60     super(subindexes, CollectionConfiguration.INDEX_ELEMENT, new SubcollectionIndex());
     61    super(subindexes, StaticStrings.INDEX_ELEMENT, new SubcollectionIndex());
    6162    DebugStream.println("SubcollectionIndexManager: " + getSize() + " subcollection indexes parsed.");
    6263    this.model = this;
    6364
    6465    // 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);
    6667    if (default_index_elements.getLength() > 0) {
    6768        default_index = new SubcollectionIndex((Element) default_index_elements.item(0));
     
    7980    if (!contains(subcollection_index)) {
    8081        // 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());
    8283        metadatum.setValue(subcollection_index.getID());
    8384        CollectionDesignManager.collectionmeta_manager.addMetadatum(metadatum);
     
    164165    if (subcollection_index != null) {
    165166        // 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());
    167168
    168169        // Check if the index removed happens to be the default index
     
    197198    private void replaceSubcollectionIndex(SubcollectionIndex old_subcollection, SubcollectionIndex new_subcollection) {
    198199    // 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());
    200201    // 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());
    202203    metadatum.setValue(new_subcollection.getID());
    203204    CollectionDesignManager.collectionmeta_manager.addMetadatum(metadatum);
     
    227228        if (default_index == null) {
    228229        // 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);
    230231        default_index = new SubcollectionIndex(default_index_element);
    231232        Node target_node = CollectionConfiguration.findInsertionPoint(default_index_element);
  • trunk/gli/src/org/greenstone/gatherer/cdm/SuperCollection.java

    r8243 r12641  
    2727package org.greenstone.gatherer.cdm;
    2828
    29 /**************************************************************************************
    30  * Written:     02/07/03
    31  * Revised:     
    32  **************************************************************************************/
     29import org.greenstone.gatherer.util.StaticStrings;
    3330import org.w3c.dom.Element;
     31
    3432
    3533public class SuperCollection
     
    6765    public String getName() {
    6866    if(name == null && element != null) {
    69         name = element.getAttribute(CollectionConfiguration.NAME_ATTRIBUTE);
     67        name = element.getAttribute(StaticStrings.NAME_ATTRIBUTE);
    7068    }
    7169    return name;
     
    7371
    7472    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));
    7674    }
    7775
    7876    public void setAssigned(boolean assigned) {
    7977    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));
    8179    }
    8280    }
     
    9088    this.name = name;
    9189    if(element != null) {
    92         element.setAttribute(CollectionConfiguration.NAME_ATTRIBUTE, name);
     90        element.setAttribute(StaticStrings.NAME_ATTRIBUTE, name);
    9391    }
    9492    }
  • trunk/gli/src/org/greenstone/gatherer/cdm/TranslationView.java

    r12123 r12641  
    3939import org.greenstone.gatherer.gui.DesignPaneHeader;
    4040import org.greenstone.gatherer.gui.GLIButton;
     41import org.greenstone.gatherer.util.StaticStrings;
     42
    4143
    4244/** 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.
     
    147149    public String getName() {
    148150        if(content instanceof Index) {
    149         return CollectionConfiguration.STOP_CHARACTER + ((Index)content).getID();
     151        return StaticStrings.STOP_CHARACTER + ((Index)content).getID();
    150152        }
    151153        else if (content instanceof SubcollectionIndex) {
    152             return CollectionConfiguration.STOP_CHARACTER + ((SubcollectionIndex)content).getID();
     154            return StaticStrings.STOP_CHARACTER + ((SubcollectionIndex)content).getID();
    153155        }
    154156        else {
     
    160162        if(text == null) {
    161163        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));
    164166        }
    165167        if(content instanceof Index) {
  • trunk/gli/src/org/greenstone/gatherer/download/Download.java

    r12529 r12641  
    202202
    203203    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));
    205205    }
    206206
    207207    public void setAssigned(boolean assigned) {
    208208    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));
    210210    }
    211211    }
Note: See TracChangeset for help on using the changeset viewer.