Changeset 7482


Ignore:
Timestamp:
2004-05-27T17:12:03+12:00 (20 years ago)
Author:
mdewsnip
Message:

Some tidy ups in preparation for finalising the workspace and collection tree refreshing.

Location:
trunk/gli/src/org/greenstone/gatherer
Files:
8 edited

Legend:

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

    r7326 r7482  
    138138    Gatherer.config.addDirectoryMapping(name, file);
    139139    // Now update the tree
    140     Gatherer.g_man.gather_pane.refreshWorkspaceTree(WorkspaceTree.MAPPED_DIRECTORIES_CHANGED);
     140    Gatherer.g_man.refreshWorkspaceTree(WorkspaceTree.MAPPED_DIRECTORIES_CHANGED);
    141141    }
    142142    /** This method calls the builcol.pl scripts via a GShell so as to not lock up the processor.
     
    476476        // workspace_model = null;
    477477        // set the view to Gather pane
    478         Gatherer.g_man.setSelectedView(Gatherer.g_man.gather_pane);
     478        Gatherer.g_man.returnToInitialPane();
    479479        Gatherer.g_man.collectionChanged(ready());
    480480    }
     
    11981198    File file = Gatherer.config.removeDirectoryMapping(target.toString());
    11991199    // Update tree.
    1200     Gatherer.g_man.gather_pane.refreshWorkspaceTree(WorkspaceTree.MAPPED_DIRECTORIES_CHANGED);
     1200    Gatherer.g_man.refreshWorkspaceTree(WorkspaceTree.MAPPED_DIRECTORIES_CHANGED);
    12011201    return file;
    12021202    }
  • trunk/gli/src/org/greenstone/gatherer/collection/DeleteCollectionPrompt.java

    r7326 r7482  
    326326        list_model.removeElement(collection);
    327327
    328         // Refresh the collects shown in the workspace tree
    329         Gatherer.g_man.gather_pane.refreshWorkspaceTree(DragTree.LIBRARY_CONTENTS_CHANGED);
     328        // Refresh the collections shown in the workspace tree
     329        Gatherer.g_man.refreshWorkspaceTree(DragTree.LIBRARY_CONTENTS_CHANGED);
    330330
    331331        resultPrompt(true);
  • trunk/gli/src/org/greenstone/gatherer/collection/Job.java

    r6842 r7482  
    481481    progress.downloadComplete();
    482482    Gatherer.println("Current File: " + current_file_downloading);
     483    // !! TEMPORARILY DISABLED !!
    483484    //WorkspaceTreeModel.refreshWebCacheMappings();
    484     if(Gatherer.g_man.gather_pane.workspace_tree != null) {
    485         FileSystemModel tree_model = (FileSystemModel) Gatherer.g_man.gather_pane.workspace_tree.getModel();
    486         File new_file = new File(current_file_downloading);
    487         File parent_file = new_file.getParentFile();
    488         String download_cache = Utility.getCacheDir().getAbsolutePath();
    489         ArrayList raw_path = new ArrayList();
    490         while(parent_file != null && !parent_file.getAbsolutePath().equals(download_cache)) {
    491         raw_path.add(0, parent_file.getName());
    492         parent_file = parent_file.getParentFile();
    493         }
    494         download_cache = null;
    495         // Add download cache name
    496         /** @todo - add to dictionary */
    497         raw_path.add(0, "Mirroring.Mirror_Cache");
    498         // And the root node
    499         raw_path.add(0, tree_model.getRoot());
    500         TreePath destination_path = new TreePath(raw_path.toArray());
    501         raw_path = null;
    502         // Retrieve the destination node
    503         FileNode destination_node = (FileNode) tree_model.getNode(destination_path);
    504         // destination_path = null;
    505         //FileNode new_file_node = new FileNode(new_file);
    506 
    507         // It suddenly occurs to me that by retrieving the destination path, we are causing the potential destination node to map its children which includes the file which I am about to add. Hence I was ending up with two copies.
    508         ///atherer.println("Ready to insert new FileNode.");
    509         Gatherer.println("Model:            " + tree_model);
    510         Gatherer.println("Destination path: " + destination_path);
    511         destination_node.unmap();
    512         ///atherer.println("Destination node: " + destination_node);
    513         ///atherer.println("New node:         " + new_file_node);
    514         //SynchronizedTreeModelTools.insertNodeInto(tree_model, destination_node, new_file_node);
    515 
    516         //new_file_node = null;
    517         destination_node = null;
    518         tree_model = null;
    519     }
    520     url = null;
    521     current_url = null;
     485//      if(Gatherer.g_man.gather_pane.workspace_tree != null) {
     486//          FileSystemModel tree_model = (FileSystemModel) Gatherer.g_man.gather_pane.workspace_tree.getModel();
     487//          File new_file = new File(current_file_downloading);
     488//          File parent_file = new_file.getParentFile();
     489//          String download_cache = Utility.getCacheDir().getAbsolutePath();
     490//          ArrayList raw_path = new ArrayList();
     491//          while(parent_file != null && !parent_file.getAbsolutePath().equals(download_cache)) {
     492//          raw_path.add(0, parent_file.getName());
     493//          parent_file = parent_file.getParentFile();
     494//          }
     495//          download_cache = null;
     496//          // Add download cache name
     497//          /** @todo - add to dictionary */
     498//          raw_path.add(0, "Mirroring.Mirror_Cache");
     499//          // And the root node
     500//          raw_path.add(0, tree_model.getRoot());
     501//          TreePath destination_path = new TreePath(raw_path.toArray());
     502//          raw_path = null;
     503//          // Retrieve the destination node
     504//          FileNode destination_node = (FileNode) tree_model.getNode(destination_path);
     505//          // destination_path = null;
     506//          //FileNode new_file_node = new FileNode(new_file);
     507
     508//          // It suddenly occurs to me that by retrieving the destination path, we are causing the potential destination node to map its children which includes the file which I am about to add. Hence I was ending up with two copies.
     509//          ///atherer.println("Ready to insert new FileNode.");
     510//          Gatherer.println("Model:            " + tree_model);
     511//          Gatherer.println("Destination path: " + destination_path);
     512//          destination_node.unmap();
     513//          ///atherer.println("Destination node: " + destination_node);
     514//          ///atherer.println("New node:         " + new_file_node);
     515//          //SynchronizedTreeModelTools.insertNodeInto(tree_model, destination_node, new_file_node);
     516
     517//          //new_file_node = null;
     518//          destination_node = null;
     519//          tree_model = null;
     520//      }
     521//      url = null;
     522//      current_url = null;
    522523    }
    523524
  • trunk/gli/src/org/greenstone/gatherer/file/FileQueue.java

    r7360 r7482  
    575575            }
    576576            synchronized(this) {
    577             ///ystem.err.println("Queue size = " + queue.size());
    578             // Force the trees to refresh (but only if there is something on screen!)
    579             if(Gatherer.g_man != null) {
    580                 Gatherer.g_man.refreshTrees(DragTree.COLLECTION_CONTENTS_CHANGED);
    581             }
     577            // Force both workspace and collection trees to refresh
     578            if (Gatherer.g_man != null) {
     579                Gatherer.g_man.refreshWorkspaceTree(DragTree.COLLECTION_CONTENTS_CHANGED);
     580                Gatherer.g_man.refreshCollectionTree(DragTree.COLLECTION_CONTENTS_CHANGED);
     581            }
     582
    582583            // Reset status area
    583584            file_status.setText(Dictionary.get("FileActions.No_Activity"));
  • trunk/gli/src/org/greenstone/gatherer/gui/GUIManager.java

    r7326 r7482  
    9191    public MirrorPane mirror_pane = null;
    9292    /** The gather pane is more like a file manager where you drag files from one tree to another. */
    93     public GatherPane gather_pane = null;
     93    private GatherPane gather_pane = null;
    9494    /** The enrich pane is used to assign, edit and remove metadata from files within the collection. */
    9595    public EnrichPane enrich_pane = null;
     
    619619    }
    620620
    621     public void refreshTrees(int refresh_reason)
     621
     622    public void refreshCollectionTree(int refresh_reason)
     623    {
     624    if (gather_pane != null) {
     625        gather_pane.refreshCollectionTree(refresh_reason);
     626    }
     627    }
     628
     629
     630    public void refreshWorkspaceTree(int refresh_reason)
    622631    {
    623632    if (gather_pane != null) {
    624633        gather_pane.refreshWorkspaceTree(refresh_reason);
    625         gather_pane.refreshCollectionTree(refresh_reason);
    626     }
    627     }
    628 
    629     /** Allows the system to programatically set the selected tab.
    630      * @param component The view you wish to make visable in the tab pane as a <strong>Component</strong>.
    631      */
    632     public void setSelectedView(Component component) {
    633     tab_pane.setSelectedComponent(component);
    634     }
     634    }
     635    }
     636
     637
     638    /** Returns to some "initial" pane (when no collection is loaded) */
     639    public void returnToInitialPane()
     640    {
     641    if (gather_pane != null) {
     642        tab_pane.setSelectedComponent(gather_pane);
     643    }
     644    }
     645
    635646
    636647    /** Specifies whether a certain tab is enabled or not. */
  • trunk/gli/src/org/greenstone/gatherer/gui/GatherPane.java

    r7360 r7482  
    8181    /** The collection model which is used to build, and hold the data of, the collection tree. */
    8282    private TreeModel collection    = null;
    83     /** The Tree model used as the data source for the workspace tree. */
    84     private TreeModel workspace       =  null;
    8583    /** The button used to cancel all pending file queue jobs. */
    8684    private JButton stop_action        =  null;
     
    111109    /** Ensures that expansion and selection events between collection trees based on the same model are synchronized. */
    112110    private TreeSynchronizer collection_tree_sync = null;
    113     /** Ensures that expansion and selection events between workspace trees based on the same model are synchronized. */
    114     private TreeSynchronizer workspace_tree_sync = null;
    115111    /** The button used to delete files, which also doubles as a drop target for files from the Trees. */
    116112    private UndoManager bin_button          =  null;
     
    125121
    126122    /** The tree showing the available source workspace. */
    127     public WorkspaceTree workspace_tree  =  null;
     123    private WorkspaceTree workspace_tree = null;
     124
    128125
    129126    /* Constructor.
     
    136133    this.file_queue = Gatherer.f_man.getQueue();
    137134    this.collection_tree_sync = collection_tree_sync;
    138     this.workspace_tree_sync = workspace_tree_sync;
    139135   
    140136    // Create components.
  • trunk/gli/src/org/greenstone/gatherer/gui/Preferences.java

    r7339 r7482  
    737737
    738738        Gatherer.config.set("general.show_file_size", Configuration.COLLECTION_SPECIFIC, show_file_size_checkbox.isSelected());
    739         Gatherer.g_man.refreshTrees(DragTree.TREE_DISPLAY_CHANGED);
     739        // Force both workspace and collection trees to redraw
     740        if (Gatherer.g_man != null) {
     741        Gatherer.g_man.refreshWorkspaceTree(DragTree.COLLECTION_CONTENTS_CHANGED);
     742        Gatherer.g_man.refreshCollectionTree(DragTree.COLLECTION_CONTENTS_CHANGED);
     743        }
    740744
    741745        Gatherer.config.set("general.view_extracted_metadata", Configuration.COLLECTION_SPECIFIC, view_extracted_metadata_checkbox.isSelected());
  • trunk/gli/src/org/greenstone/gatherer/gui/tree/WorkspaceTree.java

    r6086 r7482  
    1717
    1818
    19     public WorkspaceTree(String name) {
     19    public WorkspaceTree(String name)
     20    {
    2021    super(name, WorkspaceTreeModel.getWorkspaceTreeModel(), null, true);
    2122    }
    2223
    2324
    24     public void refresh(int refresh_reason) {
     25    public void refresh(int refresh_reason)
     26    {
    2527    Gatherer.println("WorkspaceTree::refresh()... ");
    2628
     
    4749
    4850    // The method for displaying the tree has changed - redraw the tree
    49     if (refresh_reason == DragTree.TREE_DISPLAY_CHANGED) {
    50         Gatherer.println("...Reason: tree display changed.");
    51         updateUI();
    52     }
     51    if (refresh_reason == DragTree.TREE_DISPLAY_CHANGED) {
     52        Gatherer.println("...Reason: tree display changed.");
     53        updateUI();
     54    }
    5355
    5456    // The collection specific mapped directories have changed - refresh only them
     
    8284        }
    8385
    84         // If the collection import directory is open, it must be refreshed
     86        // If the specified folder is open, it must be refreshed
    8587        if (tree_node_path_str.equals(folder_path_str)) {
    8688        System.err.println("Must refresh node " + tree_node_path_str + "!");
Note: See TracChangeset for help on using the changeset viewer.