Ignore:
Timestamp:
2004-01-22T16:19:34+13:00 (20 years ago)
Author:
jmt12
Message:

Started effecting the changes requested by Ian and David. So far I've removed the complex arguments, and have ensured that the path is correct for downloads without page requisites. I've also tried to get the workspace tree to update properly, and it is much closer than before but it is now temporarily displaying the same node twice.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/gli/src/org/greenstone/gatherer/collection/Job.java

    r6582 r6590  
    4545import org.greenstone.gatherer.Gatherer;
    4646import org.greenstone.gatherer.WGet;
     47import org.greenstone.gatherer.file.FileNode;
     48import org.greenstone.gatherer.file.FileSystemModel;
     49import org.greenstone.gatherer.file.WorkspaceTreeModel;
    4750import org.greenstone.gatherer.gui.GProgressBar;
    4851import org.greenstone.gatherer.util.GURL;
     52import org.greenstone.gatherer.util.SynchronizedTreeModelTools;
    4953import org.greenstone.gatherer.util.Utility;
    5054/**
     
    163167    ///ystem.out.println("addLink("+url+", "+type+")");
    164168    if(!encountered_urls.contains(raw_url)) {
    165                 // Add it to the urls we've seen.
     169        // Add it to the urls we've seen.
    166170        encountered_urls.add(raw_url);
    167                 // Add it the to links for the current GURL.
    168 
    169                 // Add it to the progress file count.
     171        // Add it the to links for the current GURL.
     172
     173        // Add it to the progress file count.
    170174        progress.increaseFileCount();
    171175        return true;
     
    280284            }
    281285        }
    282         // If line contains "saved [<size>]" set currently
     286        // If line contains "/s) - `" set currently
    283287        // downloading url to "Download Complete".
    284         else if(line.lastIndexOf(") - `") != -1) {
     288        else if(line.lastIndexOf("/s) - `") != -1) {
     289            String current_file_downloading = line.substring(line.indexOf("`") + 1, line.lastIndexOf("'"));
    285290            if(!ignore_for_robots) {
     291            System.err.println("Not ignore for robots");
    286292            // Download complete
    287             downloadComplete();
     293            downloadComplete(current_file_downloading);
    288294            }
    289295            else {
     296            System.err.println("Ignore for robots");
    290297            ignore_for_robots = false;
    291298            }
     
    445452    public void downloadComplete() {
    446453    progress.downloadComplete();
    447     /* @todo
    448        model.add(url.getURL(), destination);
    449     */
     454    url = null;
     455    current_url = null;
     456    }
     457
     458    public void downloadComplete(String current_file_downloading) {
     459    progress.downloadComplete();
     460    ///ystem.err.println("Current File: " + current_file_downloading);
     461    //WorkspaceTreeModel.refreshWebCacheMappings();
     462    if(Gatherer.g_man.collection_pane.workspace_tree != null) {
     463        FileSystemModel tree_model = (FileSystemModel) Gatherer.g_man.collection_pane.workspace_tree.getModel();
     464        File new_file = new File(current_file_downloading);
     465        File parent_file = new_file.getParentFile();
     466        String download_cache = Utility.getCacheDir().getAbsolutePath();
     467        ArrayList raw_path = new ArrayList();
     468        while(parent_file != null && !parent_file.getAbsolutePath().equals(download_cache)) {
     469        raw_path.add(0, parent_file.getName());
     470        parent_file = parent_file.getParentFile();
     471        }
     472        download_cache = null;
     473        // Add download cache name
     474        /** @todo - add to dictionary */
     475        raw_path.add(0, "Mirror Cache");
     476        // And the root node
     477        raw_path.add(0, tree_model.getRoot());
     478        TreePath destination_path = new TreePath(raw_path.toArray());
     479        raw_path = null;
     480        // Retrieve the destination node
     481        FileNode destination_node = (FileNode) tree_model.getNode(destination_path);
     482        // destination_path = null;
     483        FileNode new_file_node = new FileNode(new_file);
     484        SynchronizedTreeModelTools.insertNodeInto(tree_model, destination_node, new_file_node);
     485        System.err.println("Ready to insert new FileNode.");
     486        System.err.println("Model:            " + tree_model);
     487        System.err.println("Destination path: " + destination_path);
     488        System.err.println("Destination node: " + destination_node);
     489        System.err.println("New node:         " + new_file_node);
     490
     491        new_file_node = null;
     492        destination_node = null;
     493        tree_model = null;
     494    }
    450495    url = null;
    451496    current_url = null;
Note: See TracChangeset for help on using the changeset viewer.