Changeset 14359

Show
Ignore:
Timestamp:
09.08.2007 16:32:13 (12 years ago)
Author:
xiao
Message:

modify to make a Format4gs3 object contain two format features: feature_format - contains format statements plus classifier options if this object is a classifier, displayed on the format list in GLI; pure_format - contains only format statements, displayed in the format editor in GLI.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • gli/trunk/src/org/greenstone/gatherer/cdm/Format4gs3.java

    r14042 r14359  
    4444    /** We keep a copy of the feature name */ 
    4545    private String feature_name = null; 
    46     /** The format statement for this feature. */ 
     46    /** The format statement for this feature (also contains classifier options if its a classifier), used by the format list on the top in GLI. */ 
    4747    private String feature_format = null; 
     48     
     49    /** The format statement for this feature (does not contain options in the front), displayed in the format editor at the bottom in GLI.  
     50     *  If this format is not a classifier, feature_format==pure_format*/ 
     51    private String pure_format = null; 
    4852     
    4953    /** Wether this feature is about a classifier. The other way to check this is to see if feature_name starts with "CL" */ 
     
    7175            classifier_options = classifier.toString(); 
    7276 
    73             feature_format = toOneLineFormat(XMLTools.getNodeText(element)); 
    74             feature_format = classifier_options + " " + feature_format; 
     77                     
     78            pure_format = toOneLineFormat(XMLTools.getNodeText(element)); 
     79            feature_format = classifier_options + " " + pure_format; 
    7580        } else { 
    7681            feature_name = element.getAttribute(StaticStrings.NAME_ATTRIBUTE); 
    7782            feature_format = toOneLineFormat(XMLTools.getNodeText(element)); 
     83            pure_format = feature_format; 
    7884        } 
    7985 
     
    8389        this.feature_name = feature_name; 
    8490        this.feature_format = feature_format; 
     91        this.pure_format = feature_format; 
     92         
    8593        is_classifier = feature_name.startsWith (Classifier.CLASSIFIER_PREFIX); 
    8694         
    8795        element = CollectionConfiguration.createElement (StaticStrings.FORMAT_STR); 
    88         if(feature_name.startsWith(Classifier.CLASSIFIER_PREFIX)) { 
     96        if(is_classifier) { 
    8997             
    9098            //Now get the options of the classifier 
     
    92100            //set the classifier_options string 
    93101            classifier_options = classifier.toString(); 
    94  
     102             
    95103            feature_format = classifier_options + " " + feature_format; 
    96104        } else { 
     
    98106        } 
    99107 
    100         XMLTools.setNodeText(element, toOneLineFormat(feature_format)); 
     108        XMLTools.setNodeText(element, toOneLineFormat(pure_format)); 
    101109 
    102110    } 
     
    138146    } 
    139147             
    140     /** Method to translate this classes information into a line of text as you would expect on the format list panel 
     148    /** Method to translate this class information into a line of text as you would expect on the format list panel 
    141149     * @return A <strong>String</strong> containing the format command. 
    142150     */ 
     
    152160            //update the classifier_options string 
    153161            classifier_options = classifier.toString(); 
    154  
    155             feature_format = classifier_options + " " + toOneLineFormat(XMLTools.getNodeText(element)); 
     162            pure_format = toOneLineFormat(XMLTools.getNodeText(element)); 
     163            feature_format = classifier_options + " " + pure_format; 
    156164        } 
    157165    }     
     
    159167        return toFormatedFormat(feature_format); 
    160168    } 
     169    public String getPureFormat() { 
     170        return toFormatedFormat(pure_format); 
     171    } 
     172     
    161173    public Classifier getClassifier() { 
    162174        if(!isClassifier()) { 
     
    176188     */ 
    177189    public void setFeatureFormat (String value) { 
    178         feature_format = value; 
    179         XMLTools.setNodeText(element, feature_format); 
     190        if(is_classifier) { 
     191          feature_format = classifier_options + " " + value; 
     192        } else { 
     193          feature_format = value; 
     194        } 
     195    } 
     196    public void setPureFormat (String value) { 
     197        pure_format = value; 
     198        setFeatureFormat (value); 
     199        XMLTools.setNodeText(element, pure_format); 
    180200    } 
    181201    public static String toOneLineFormat(String str) {