Changeset 19226 for gli


Ignore:
Timestamp:
2009-04-23T15:05:46+12:00 (15 years ago)
Author:
kjdon
Message:

added code to handle collect groups

File:
1 edited

Legend:

Unmodified
Added
Removed
  • gli/trunk/src/org/greenstone/gatherer/file/WorkspaceTreeNode.java

    r14048 r19226  
    4646{
    4747    private boolean is_gs3_site_node = false;
     48    private boolean is_group_node = false;
    4849    private boolean is_in_loaded_collection = false;
    4950    private String title = null;
     
    127128        model.nodeStructureChanged(this);
    128129       
    129         } else if (title.equals(Dictionary.get("Tree.World")) || is_gs3_site_node) {
     130        } else if (title.equals(Dictionary.get("Tree.World")) || is_gs3_site_node || is_group_node) {
    130131        // For each of the children directories, which are collections...
    131132        File start;
    132         if (is_gs3_site_node) {
     133        if (is_gs3_site_node ) {
    133134            start = new File(Gatherer.getSitesDirectoryPath() + title + File.separator + "collect" + File.separator);
    134         } else {
     135        }
     136        else if (is_group_node) {
     137          start = new File(Gatherer.getCollectDirectoryPath() + title);
     138        }
     139        else {
    135140            start = new File(Gatherer.getCollectDirectoryPath());
    136141        }
     
    141146        for (int i = 0; cols != null && i < cols.length; i++) {
    142147            if (!cols[i].getName().equals(StaticStrings.MODEL_COLLECTION_NAME)) {
    143             File import_dir = new File(cols[i], "import");
    144             if (!import_dir.exists()) {
    145                 continue;
    146             }
    147 
    148             // we don't care if there is no config file
     148            // check for groups
    149149            String file_name = (Gatherer.GS3)? Utility.CONFIG_GS3_FILE : Utility.CONFIG_FILE;
    150150            BasicCollectionConfiguration collect_cfg = new BasicCollectionConfiguration(new File(cols[i], file_name));
    151             WorkspaceTreeNode collection_root = new WorkspaceTreeNode(import_dir, collect_cfg.toString());
    152             collection_root.setParent(this);
    153             collection_root.setModel(model);
    154 
    155             // One last piece of magic so we can determine the current collection
    156             collection_root.is_in_loaded_collection = cols[i].getName().equals(CollectionManager.getLoadedCollectionName());
    157             child_nodes.add(collection_root);
     151            if (collect_cfg.getCollectGroup().equals("true")) {
     152              WorkspaceTreeNode child = new WorkspaceTreeNode(null, cols[i].getName());
     153              child.is_group_node = true;
     154              child.unmap();
     155              child.setModel(model);
     156              child.setParent(this);
     157              child.map();
     158              child_nodes.add(child);
     159            } else {
     160              File import_dir = new File(cols[i], "import");
     161              if (!import_dir.exists()) {
     162                continue;
     163              }
     164             
     165              WorkspaceTreeNode collection_root = new WorkspaceTreeNode(import_dir, collect_cfg.toString());
     166              collection_root.setParent(this);
     167              collection_root.setModel(model);
     168             
     169              // One last piece of magic so we can determine the current collection
     170              collection_root.is_in_loaded_collection = cols[i].getName().equals(CollectionManager.getLoadedCollectionName());
     171              child_nodes.add(collection_root);
     172            }
    158173            }
    159174        }
Note: See TracChangeset for help on using the changeset viewer.