Changeset 7484
- Timestamp:
- 2004-05-28T13:41:13+12:00 (20 years ago)
- Location:
- trunk/gli/src/org/greenstone/gatherer
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gli/src/org/greenstone/gatherer/collection/CollectionManager.java
r7482 r7484 138 138 Gatherer.config.addDirectoryMapping(name, file); 139 139 // Now update the tree 140 Gatherer.g_man.refreshWorkspaceTree(WorkspaceTree. MAPPED_DIRECTORIES_CHANGED);140 Gatherer.g_man.refreshWorkspaceTree(WorkspaceTree.FOLDER_SHORTCUTS_CHANGED); 141 141 } 142 142 /** This method calls the builcol.pl scripts via a GShell so as to not lock up the processor. … … 411 411 collection.cdm = new CollectionDesignManager(new File(getCollectionConfig())); 412 412 413 413 // Now that we have a CDM, update several settings, such as if we created this collection by basing it on another, set it as public automatically 414 414 if(base_collection_directory != null) { 415 415 // Update the creator and maintainer … … 472 472 Gatherer.printStackTrace(error); 473 473 } 474 // Done. 475 if(Gatherer.g_man != null) {476 // workspace_model = null;477 // set the view to Gather pane474 475 // Done, so refresh interface 476 if (Gatherer.g_man != null) { 477 // Return to some initial pane (Gather) 478 478 Gatherer.g_man.returnToInitialPane(); 479 480 // Refresh the workspace tree to allow for the new collection 481 Gatherer.g_man.refreshWorkspaceTree(WorkspaceTree.LIBRARY_CONTENTS_CHANGED); 482 479 483 Gatherer.g_man.collectionChanged(ready()); 480 484 } … … 719 723 720 724 721 static public FileNode[] get CollectionSpecificMappings()725 static public FileNode[] getFolderShortcuts() 722 726 { 723 727 // Return any predefined special directories … … 1198 1202 File file = Gatherer.config.removeDirectoryMapping(target.toString()); 1199 1203 // Update tree. 1200 Gatherer.g_man.refreshWorkspaceTree(WorkspaceTree. MAPPED_DIRECTORIES_CHANGED);1204 Gatherer.g_man.refreshWorkspaceTree(WorkspaceTree.FOLDER_SHORTCUTS_CHANGED); 1201 1205 return file; 1202 1206 } -
trunk/gli/src/org/greenstone/gatherer/collection/DeleteCollectionPrompt.java
r7482 r7484 49 49 import org.greenstone.gatherer.gui.ModalDialog; 50 50 import org.greenstone.gatherer.gui.SimpleMenuBar; 51 import org.greenstone.gatherer.gui.tree. DragTree;51 import org.greenstone.gatherer.gui.tree.WorkspaceTree; 52 52 import org.greenstone.gatherer.util.ArrayTools; 53 53 import org.greenstone.gatherer.util.GSDLSiteConfig; … … 327 327 328 328 // Refresh the collections shown in the workspace tree 329 Gatherer.g_man.refreshWorkspaceTree( DragTree.LIBRARY_CONTENTS_CHANGED);329 Gatherer.g_man.refreshWorkspaceTree(WorkspaceTree.LIBRARY_CONTENTS_CHANGED); 330 330 331 331 resultPrompt(true); -
trunk/gli/src/org/greenstone/gatherer/file/FileManager.java
r7361 r7484 131 131 FileNode folder_node = new FileNode(folder_file); 132 132 SynchronizedTreeModelTools.insertNodeInto(model, parent_node, folder_node); 133 134 // Refresh workspace tree (collection tree is done automatically) 135 Gatherer.g_man.refreshWorkspaceTree(DragTree.COLLECTION_CONTENTS_CHANGED); 136 133 137 folder_node = null; 134 138 } -
trunk/gli/src/org/greenstone/gatherer/file/WorkspaceTreeModel.java
r7203 r7484 2 2 3 3 import javax.swing.tree.TreePath; 4 import org.greenstone.gatherer.Gatherer; 4 5 import org.greenstone.gatherer.collection.CollectionManager; 5 6 import org.greenstone.gatherer.file.FileNode; … … 13 14 static private FileNode workspace_tree_root = null; 14 15 static private WorkspaceTreeModel workspace_tree_model = null; 16 15 17 static private FileNode greenstone_collections_mapping = null; 16 18 static private FileNode local_filespace_mapping = null; 17 static private FileNode web_cache_mapping = null;18 static private FileNode[] collection_specific_mappings = null;19 // static private FileNode web_cache_mapping = null; 20 static private FileNode[] folder_shortcuts = null; 19 21 20 22 … … 43 45 44 46 // Add public and private web caches if applicable 45 loadWebCacheMappings();47 // loadWebCacheMappings(); 46 48 47 // Add any collection specific mappings48 loadCollectionSpecificMappings();49 // Add any folder shortcuts the user has created 50 refreshFolderShortcuts(); 49 51 50 52 return workspace_tree_model; … … 52 54 53 55 54 static private void loadWebCacheMappings()55 {56 // If mirroring is enabled show the public and private caches57 web_cache_mapping = MirrorPane.getWebCacheMapping();58 if (web_cache_mapping != null) {59 workspace_tree_root.insert(web_cache_mapping);60 }61 }62 63 64 static private void loadCollectionSpecificMappings()65 {66 ///ystem.err.print("Load Collection Specific Mappings... ");67 // Add the current collection specific mappings68 collection_specific_mappings = CollectionManager.getCollectionSpecificMappings();69 ///ystem.err.print("Retrieved Mappings... ");70 if (collection_specific_mappings != null) {71 for (int i = 0; i < collection_specific_mappings.length; i++) {72 ///ystem.err.print("Setting " + i + " Mapping... ");73 SynchronizedTreeModelTools.insertNodeInto(workspace_tree_model, workspace_tree_root, collection_specific_mappings[i], false);74 }75 }76 ///ystem.err.println("Done.");77 }78 79 80 // !! NEEDS WORK !!81 56 static public void refreshGreenstoneCollectionsMapping() 82 57 { … … 86 61 87 62 88 // !! NEEDS WORK !! 89 static public void refreshWebCacheMappings() 63 static public void refreshFolderShortcuts() 90 64 { 91 if (web_cache_mapping != null) {92 SynchronizedTreeModelTools.removeNodeFromParent(workspace_tree_model, web_cache_mapping);93 }65 // Check for new/deleted folder shortcuts 66 FileNode[] old_folder_shortcuts = folder_shortcuts; 67 folder_shortcuts = CollectionManager.getFolderShortcuts(); 94 68 95 loadWebCacheMappings(); 96 97 } 98 99 100 // !! NEEDS WORK !! 101 static public void refreshCollectionSpecificMappings() 102 { 103 // Remove all the old collection specific mappings 104 if (collection_specific_mappings != null) { 105 for (int i = 0; i < collection_specific_mappings.length; i++) { 106 SynchronizedTreeModelTools.removeNodeFromParent(workspace_tree_model, 107 collection_specific_mappings[i]); 69 // Remove any deleted shortcuts from the tree 70 if (old_folder_shortcuts != null) { 71 for (int i = 0; i < old_folder_shortcuts.length; i++) { 72 if (!doesArrayContain(folder_shortcuts, old_folder_shortcuts[i])) { 73 Gatherer.println("Deleted shortcut: " + old_folder_shortcuts[i]); 74 SynchronizedTreeModelTools.removeNodeFromParent(workspace_tree_model, 75 old_folder_shortcuts[i]); 76 } 108 77 } 109 78 } 110 79 111 loadCollectionSpecificMappings(); 80 // Add any new shortcuts to the tree 81 if (folder_shortcuts != null) { 82 for (int i = 0; i < folder_shortcuts.length; i++) { 83 if (!doesArrayContain(old_folder_shortcuts, folder_shortcuts[i])) { 84 Gatherer.println("Added shortcut: " + folder_shortcuts[i]); 85 SynchronizedTreeModelTools.insertNodeInto(workspace_tree_model, workspace_tree_root, folder_shortcuts[i], false); 86 } 87 } 88 } 112 89 } 113 90 … … 132 109 } 133 110 } 111 112 113 static private boolean doesArrayContain(Object[] array, Object item) 114 { 115 if (array == null) { 116 return false; 117 } 118 119 for (int i = 0; i < array.length; i++) { 120 if (item.toString().equals(array[i].toString())) { 121 return true; 122 } 123 } 124 125 return false; 126 } 134 127 } -
trunk/gli/src/org/greenstone/gatherer/gui/GUIManager.java
r7482 r7484 681 681 // If the rawname was mirror then rebuild workspace tree to remove caches. 682 682 if (rawname.equals("Mirror")) { 683 gather_pane.refreshWorkspaceTree(WorkspaceTree.MAPPED_DIRECTORIES_CHANGED);683 // gather_pane.refreshWorkspaceTree(WorkspaceTree.FOLDER_SHORTCUTS_CHANGED); 684 684 } 685 685 } -
trunk/gli/src/org/greenstone/gatherer/gui/GatherPane.java
r7482 r7484 246 246 collection_tree_sync.add(collection_tree); 247 247 248 refreshWorkspaceTree(DragTree.LOADED_COLLECTION_CHANGED);248 // Refresh the collection tree (the workspace tree stays the same) 249 249 refreshCollectionTree(DragTree.LOADED_COLLECTION_CHANGED); 250 250 -
trunk/gli/src/org/greenstone/gatherer/gui/tree/DragTree.java
r6249 r7484 58 58 static private final int AUTOSCROLL_MARGIN = 12; 59 59 60 static public int LIBRARY_CONTENTS_CHANGED= 0;60 static public int TREE_DISPLAY_CHANGED = 0; 61 61 static public int LOADED_COLLECTION_CHANGED = 1; 62 62 static public int COLLECTION_CONTENTS_CHANGED = 2; 63 static public int TREE_DISPLAY_CHANGED = 3;64 63 65 64 -
trunk/gli/src/org/greenstone/gatherer/gui/tree/WorkspaceTree.java
r7482 r7484 6 6 import org.greenstone.gatherer.Gatherer; 7 7 import org.greenstone.gatherer.file.FileNode; 8 import org.greenstone.gatherer.file.FileSystemModel;9 8 import org.greenstone.gatherer.file.WorkspaceTreeModel; 10 9 import org.greenstone.gatherer.util.Utility; … … 14 13 extends DragTree { 15 14 16 static public int MAPPED_DIRECTORIES_CHANGED = 11; 15 static public int LIBRARY_CONTENTS_CHANGED = 10; 16 static public int FOLDER_SHORTCUTS_CHANGED = 11; 17 17 18 18 … … 27 27 Gatherer.println("WorkspaceTree::refresh()... "); 28 28 29 // The collections in the library have changed - refresh the collect directory 30 if (refresh_reason == DragTree.LIBRARY_CONTENTS_CHANGED) { 31 Gatherer.println("...Reason: library contents changed."); 32 String collect_directory_str = Gatherer.config.gsdl_path + Utility.COL_DIR; 33 refreshEveryNodeShowingFolder(collect_directory_str); 34 WorkspaceTreeModel.refreshGreenstoneCollectionsMapping(); 35 } 29 // The method for displaying the tree has changed - redraw the tree 30 if (refresh_reason == DragTree.TREE_DISPLAY_CHANGED) { 31 Gatherer.println("...Reason: tree display changed."); 32 updateUI(); 33 } 36 34 37 // A collection has been opened/closed - reload the whole shebang35 // The loaded collection has changed - currently do nothing 38 36 if (refresh_reason == DragTree.LOADED_COLLECTION_CHANGED) { 39 37 Gatherer.println("...Reason: loaded collection changed."); 40 setModel(WorkspaceTreeModel.getWorkspaceTreeModel());41 38 } 42 39 … … 48 45 } 49 46 50 // The method for displaying the tree has changed - redraw the tree 51 if (refresh_reason == DragTree.TREE_DISPLAY_CHANGED) { 52 Gatherer.println("...Reason: tree display changed."); 53 updateUI(); 54 } 47 // The collections in the library have changed - refresh the collect directory 48 if (refresh_reason == WorkspaceTree.LIBRARY_CONTENTS_CHANGED) { 49 Gatherer.println("...Reason: library contents changed."); 50 String collect_directory_str = Gatherer.config.gsdl_path + Utility.COL_DIR; 51 refreshEveryNodeShowingFolder(collect_directory_str); 52 WorkspaceTreeModel.refreshGreenstoneCollectionsMapping(); 53 } 55 54 56 // The collection specific mapped directories have changed - refresh only them 57 if (refresh_reason == WorkspaceTree.MAPPED_DIRECTORIES_CHANGED) { 58 Gatherer.println("...Reason: mapped directories changed."); 59 WorkspaceTreeModel.refreshWebCacheMappings(); 60 WorkspaceTreeModel.refreshCollectionSpecificMappings(); 61 updateUI(); 55 // The folder shortcuts have changed - refresh only them 56 if (refresh_reason == WorkspaceTree.FOLDER_SHORTCUTS_CHANGED) { 57 Gatherer.println("...Reason: folder shortcuts changed."); 58 WorkspaceTreeModel.refreshFolderShortcuts(); 62 59 } 63 60 } … … 87 84 if (tree_node_path_str.equals(folder_path_str)) { 88 85 System.err.println("Must refresh node " + tree_node_path_str + "!"); 89 (( FileSystemModel) getModel()).refresh(expanded_tree_path);86 ((WorkspaceTreeModel) getModel()).refresh(expanded_tree_path); 90 87 } 91 88 }
Note:
See TracChangeset
for help on using the changeset viewer.