Changeset 14038 for trunk


Ignore:
Timestamp:
2007-05-03T08:50:18+12:00 (17 years ago)
Author:
xiao
Message:

Changes made to detect whether it is in gs2 mode - should FormatManager.java be used; or gs3 mode - should Format4gs3Manager.java be used.

File:
1 edited

Legend:

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

    r13582 r14038  
    3232import org.greenstone.gatherer.DebugStream;
    3333import org.greenstone.gatherer.Gatherer;
    34 
     34import org.greenstone.gatherer.collection.CollectionManager;
     35import org.w3c.dom.*;
     36
     37//save()
     38import org.greenstone.gatherer.util.XMLTools;
     39import javax.swing.*;
    3540
    3641/** This manager provides access to submanagers, which in turn provide tools for the designing of Greenstone collections via the information stored in etc/collect.cfg. This class acts as a hub for the managers that handle specific parts of the configuration such as classifiers, format strings and language settings.
     
    5156    static public CollectionMetaManager collectionmeta_manager;
    5257    /** A list of formating strings to use at build time. */
    53     static public FormatManager format_manager;
     58    static public SharedByTwoFormatManager format_manager;
    5459    /** A manager of general options */
    5560    static public GeneralManager general_manager;
     
    124129    searchmetadata_manager = new SearchMetadataManager();
    125130    translation_manager = new TranslationView();
    126     format_manager = new FormatManager(); // Parse formats at the very end, given that they depend upon several other managers to appear properly.
     131    if (Gatherer.GS3) {
     132        format_manager = new Format4gs3Manager();
     133    } else {
     134        format_manager = new FormatManager(); // Parse formats at the very end, given that they depend upon several other managers to appear properly.
     135    }
    127136    }
    128137
     
    137146    format_manager.destroy();
    138147    format_manager = null;
     148//    format_4gs3_manager.destroy();
     149//    format_4gs3_manager = null;
    139150    general_manager.destroy();
    140151    general_manager = null;
     
    161172    subcollection_manager.modeChanged(mode);
    162173    supercollection_manager.modeChanged(mode);
    163     format_manager.modeChanged(mode);
     174    //format_manager.modeChanged(mode);
    164175    index_manager.modeChanged(mode);
    165176    translation_manager.modeChanged(mode);
     
    181192    public void save()
    182193    {
    183     collect_config.saveIfNecessary();
     194//      String msg = XMLParser.parseDOM(CollectionManager.getLoadedCollectionCfgFilePath());
     195        Element root = this.collect_config.getDocumentElement ();       
     196        String msg = XMLTools.parseDOM(XMLTools.xmlNodeToString(root));
     197            if(msg.startsWith(XMLTools.NOTWELLFORMED)) {
     198                String str = new String("The collection configuration file is not wellformed, and cannot be saved to disk.");
     199                JOptionPane.showMessageDialog(null, str, XMLTools.NOTWELLFORMED, JOptionPane.ERROR_MESSAGE);
     200            } else {
     201
     202    collect_config.saveIfNecessary();
     203            }
    184204    }
    185205
Note: See TracChangeset for help on using the changeset viewer.