Changeset 12273


Ignore:
Timestamp:
2006-07-21T13:12:04+12:00 (18 years ago)
Author:
shaoqun
Message:

added all features

Location:
trunk/gli/src/org/greenstone/gatherer/cdm
Files:
2 edited

Legend:

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

    r12088 r12273  
    4141
    4242    /** The default features (not all of these are in the Greenstone Developer's Guide). */
    43     static final public String DEFAULT_FEATURES[] = { "", "AllowExtendedOptions", "Document", "DocumentArrowsBottom", "DocumentArrowsTop", "DocumentButtons", "DocumentContents", "DocumentHeading", "DocumentImages", "DocumentText", "DocumentTitles", "DocumentUseHTML", "RelatedDocuments", "Search", "SearchTypes" };
     43    static final public String DEFAULT_FEATURES[] = { "<html><body><i>All Features</i></body></html>", "AllowExtendedOptions", "Document", "DocumentArrowsBottom", "DocumentArrowsTop", "DocumentButtons", "DocumentContents", "DocumentHeading", "DocumentImages", "DocumentText", "DocumentTitles", "DocumentUseHTML", "RelatedDocuments", "Search", "SearchTypes" };
    4444    /** The list of known feature parts. */
    4545    static final public String DEFAULT_PARTS[] = { "", "DateList", "HList", "VList" };
    4646
     47     
    4748    /** Only "" and "Search" can have parts */
    4849    static public boolean canHavePart(String name) {
    49     return (name.equalsIgnoreCase("") || name.equalsIgnoreCase("Search") || name.equalsIgnoreCase("Document"));
     50    return (name.startsWith("<html>") || name.equalsIgnoreCase("") || name.equalsIgnoreCase("Search") || name.equalsIgnoreCase("Document"));
    5051    }
    5152   
     
    5859    }
    5960    }
     61
    6062
    6163    /** Returns true if the parameter is a boolean type, false otherwise. */
     
    7072    }
    7173
     74   
    7275    /** If this format is altering a Classifier then this is the classifier in question. */
    7376    private Classifier classifier = null;
     
    8386    /** Constructor only to be used during DOMProxyListModel initialization. */
    8487    public Format() {
     88       
    8589    }
    8690
    8791    public Format(Element element) {
     92
    8893    this.element = element;
    8994    // Immediately check if we are dealing with a classifier, by retrieving the feature name. If it is a classifier, then restore the live reference immediately before anything changes it.
     
    110115        }
    111116    }
     117
     118         
    112119    }
    113120
     
    118125     */
    119126    public Format(Object feature, String part, boolean state) {
     127
    120128    element = CollectionDesignManager.collect_config.document.createElement(CollectionConfiguration.FORMAT_ELEMENT);
    121129    setName(feature, part);
    122130    setState(state);
     131     
    123132    }
    124133
     
    129138     */
    130139    public Format(Object feature, String part, String value) {
    131     element = CollectionDesignManager.collect_config.document.createElement(CollectionConfiguration.FORMAT_ELEMENT);
     140
     141    element = CollectionDesignManager.collect_config.document.createElement(CollectionConfiguration.FORMAT_ELEMENT);       
    132142    setName(feature, part);
    133143    setValue(value);
    134     }
    135 
     144     
     145    }
     146
     147     
     148 
    136149    public boolean canHavePart() {
    137150    return canHavePart(getName());
     
    190203    public String getFeatureName() {
    191204    if (feature_name == null) {
    192         String name = element.getAttribute(CollectionConfiguration.NAME_ATTRIBUTE);
     205        String name  = element.getAttribute(CollectionConfiguration.NAME_ATTRIBUTE);
    193206        // Remove part
    194207        String part = getPart();
     
    202215        name = null;
    203216    }
     217
     218    if ( feature_name.equals("")){
     219         feature_name = DEFAULT_FEATURES[0];
     220     }
     221
    204222    return feature_name;
    205223       
     
    207225    public String getName() {
    208226    if(element != null) {
    209         return element.getAttribute(CollectionConfiguration.NAME_ATTRIBUTE);
     227        String name  = element.getAttribute(CollectionConfiguration.NAME_ATTRIBUTE);
     228            if (name.equals("")){
     229        return DEFAULT_FEATURES[0];
     230        }
     231           return element.getAttribute(CollectionConfiguration.NAME_ATTRIBUTE);
    210232    }
    211233    return "Error";
     
    277299    public void setName(Object feature, String part) {
    278300    // Can't do anything unless an element exists.
     301       
    279302    if(element != null) {
    280303        this.part = part; // Easier for later on.
     
    285308        }
    286309        else {
    287         feature_name = feature.toString();
    288         element.setAttribute(CollectionConfiguration.NAME_ATTRIBUTE, feature.toString() + part);
     310                if  (feature.toString().startsWith("<html>")){
     311            feature_name = "";
     312        }
     313        else{
     314            feature_name = feature.toString();
     315        }
     316        element.setAttribute(CollectionConfiguration.NAME_ATTRIBUTE, feature_name + part);
    289317        }
    290318        text = null;
  • trunk/gli/src/org/greenstone/gatherer/cdm/FormatManager.java

    r12123 r12273  
    640640            ignore_event = true;
    641641            Entry entry = (Entry) feature_combobox.getSelectedItem();
    642             // Step one: reset part
     642           
     643                    // Step one: reset part
    643644            if (entry.canHavePart()) {
    644645            part_combobox.setEnabled(true);
     
    11171118        if(classifier != null) {
    11181119        return classifier;
     1120        }
     1121
     1122        if (text.startsWith("<html>")){
     1123        return  "";
    11191124        }
    11201125        return text;
Note: See TracChangeset for help on using the changeset viewer.