Changeset 19270


Ignore:
Timestamp:
2009-04-27T15:06:59+12:00 (15 years ago)
Author:
kjdon
Message:

don't add dc metadata set all the time. only add it if there is not a valid one already loaded

File:
1 edited

Legend:

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

    r18414 r19270  
    6767    static private Dimension LABEL_SIZE = new Dimension(150, 15);
    6868    static private Dimension ROW_SIZE = new Dimension(400, 20);
     69    static private Dimension MAX_ROW_SIZE = new Dimension(1000, 30);
    6970   
    7071    /** Available types, corresponds to the HTML input types */
     
    202203        ArrayList metadata_sets = MetadataSetManager.listMetadataSets(new File(file_name));
    203204       
    204         // if the collection doesn't have a metadata directory, load all the MDSets in the global GLI/metadata directory
    205         if (metadata_sets == null) {
    206         file_name = org.greenstone.gatherer.gems.MetadataSetManager.getGLIMetadataDirectoryPath();
    207         metadata_sets = MetadataSetManager.listMetadataSets(new File(file_name));
    208         }
    209            
    210         // always load the dc mds
    211         boolean found = false;
    212         for (int i = 0, j = metadata_sets.size(); i < j; i++) {
    213         if (((MetadataSet) metadata_sets.get(i)).getNamespace().equals("dc")) {
    214             found = true;
    215             break;
    216         }                   
    217         }
    218         if (found == false) {
     205        if (metadata_sets != null) {
     206          // unload the ex mds
     207          for (int i = 0, j = metadata_sets.size(); i < j; i++) {
     208        if (((MetadataSet) metadata_sets.get(i)).getNamespace().equals("ex")) {
     209          metadata_sets.remove(i);
     210          break;
     211        }
     212          }
     213        }
     214       
     215        if (metadata_sets == null || metadata_sets.size() == 0) {
     216          // load dublin core
    219217        file_name = org.greenstone.gatherer.gems.MetadataSetManager.getGLIMetadataDirectoryPath();
    220218        file_name += "dublin.mds";
     
    224222            metadata_sets = MetadataSetManager.getMetadataSets();
    225223        }
    226         }           
    227 
    228         // unload the ex mds
    229         for (int i = 0, j = metadata_sets.size(); i < j; i++) {
    230         if (((MetadataSet) metadata_sets.get(i)).getNamespace().equals("ex")) {
    231             metadata_sets.remove(i);
    232             break;
    233         }
    234         }
    235            
     224        }
     225        // if we are still null :-(
    236226        if (metadata_sets == null) {
    237227        System.err.println("Error: DepositorMetadataMananger can't find any valid metadata set files.");
     
    339329        setLayout(new BorderLayout());
    340330        setPreferredSize(ROW_SIZE);
     331        setMaximumSize(MAX_ROW_SIZE);
    341332           
    342333        // the checkbox component
Note: See TracChangeset for help on using the changeset viewer.