Changeset 9458


Ignore:
Timestamp:
2005-03-17T12:11:44+13:00 (19 years ago)
Author:
kjdon
Message:

fixed up the map function for GS3 - made it closer to what it used to be in FileNode.java back before Michael tidied it up :-) Now the site folders have some contents.

File:
1 edited

Legend:

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

    r9045 r9458  
    9898    {
    9999    // Special Case: "Documents in Greenstone Collections" -- map the collections installed in Greenstone
    100     if (file == null && title.equals(Dictionary.get("Tree.World"))) {
    101         // If this node has already been mapped, don't bother doing it again
     100    if (file == null) { // a special mapping folder
    102101        if (child_nodes != null) {
     102        // don't bother mapping again if we already have children
    103103        return;
    104104        }
    105105        child_nodes = new ArrayList();
    106 
    107         if (Gatherer.GS3) {
     106        if (title.equals(Dictionary.get("Tree.World")) && Gatherer.GS3) {
    108107        // the Greenstone collections folder for GS3 - this contains a
    109108        // folder for each site
     109
    110110        File start = new File(Utility.getSitesDir(Configuration.gsdl3_path));
    111111        File sites[] = start.listFiles();
     
    119119            WorkspaceTreeNode child = new WorkspaceTreeNode(null, sites[i].getName());
    120120            child.is_gs3_site_node = true;
     121            child.unmap();
    121122            child.setModel(model);
    122123            child.setParent(this);
     124            child.map();
    123125            child_nodes.add(child);
    124126        }
    125         }
    126         else {
     127        model.nodeStructureChanged(this);
     128       
     129        } else if (title.equals(Dictionary.get("Tree.World")) || is_gs3_site_node) {
    127130        // For each of the children directories, which are collections...
    128131        File start;
     
    159162        model.nodeStructureChanged(this);
    160163        }
    161     }
    162 
    163     // Special Case: "Local Filespace" on Windows -- create a node for each filesystem root (drive letter)
    164     else if (file == null && title.equals(Dictionary.get("Tree.Root"))) {
    165         // If this node has already been mapped, don't bother doing it again
    166         if (child_nodes != null) {
    167         return;
    168         }
    169         child_nodes = new ArrayList();
    170 
    171         // Sort the roots into alphabetical order
    172         File[] roots = File.listRoots();
    173         ArrayTools.sort(roots);
    174         for (int i = 0; i < roots.length; i++) {
    175         // Only add root if it isn't a floppy drive
    176         if (!FileSystemView.getFileSystemView().isFloppyDrive(roots[i])) {
    177             child_nodes.add(addChildNode(roots[i]));
     164        else if (title.equals(Dictionary.get("Tree.Root"))) {
     165        // Special Case: "Local Filespace" on Windows -- create a node for each filesystem root (drive letter)
     166       
     167        // Sort the roots into alphabetical order
     168        File[] roots = File.listRoots();
     169        ArrayTools.sort(roots);
     170        for (int i = 0; i < roots.length; i++) {
     171            // Only add root if it isn't a floppy drive
     172            if (!FileSystemView.getFileSystemView().isFloppyDrive(roots[i])) {
     173            child_nodes.add(addChildNode(roots[i]));
     174            }
    178175        }
    179176        }
    180     }
    181 
     177    } // if file == null
     178   
    182179    // General case
    183180    else {
     
    195192    return super.toString();
    196193    }
     194
    197195}
Note: See TracChangeset for help on using the changeset viewer.