Changeset 5869
- Timestamp:
- 2003-11-18T14:10:45+13:00 (20 years ago)
- Location:
- trunk/gli/src/org/greenstone/gatherer
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gli/src/org/greenstone/gatherer/file/WorkspaceTreeModel.java
r5854 r5869 3 3 import org.greenstone.gatherer.collection.CollectionManager; 4 4 import org.greenstone.gatherer.file.FileNode; 5 import org.greenstone.gatherer.gui.MirrorPane; 5 6 import org.greenstone.gatherer.util.SynchronizedTreeModelTools; 6 7 … … 12 13 static private WorkspaceTreeModel workspace_tree_model = null; 13 14 static private FileNode greenstone_collections_mapping = null; 15 static private FileNode public_web_cache_mapping = null; 16 static private FileNode private_web_cache_mapping = null; 14 17 static private FileNode[] collection_specific_mappings = null; 15 18 … … 37 40 workspace_tree_root.insert(FileSystem.getUserHomeMapping()); 38 41 39 // If mirroring is enabled show the public and private caches 40 // if (Gatherer.config.get("workflow.mirror", false)) { 41 // // Add Public workspace 42 // FileNode public_root = new FileNode(new File(Utility.CACHE_DIR), Dictionary.get("Tree.Public")); 43 // workspace_root.insert(public_root); 44 // // Add Private workspace if a collection has been loaded. 45 // if(ready()) { 46 // FileNode private_root = new FileNode(new File(getCollectionCache()), Dictionary.get("Tree.Private")); 47 // workspace_root.insert(private_root); 48 // } 49 // } 42 // Add public and private web caches if applicable 43 loadWebCacheMappings(); 50 44 51 45 // Add any collection specific mappings 46 loadCollectionSpecificMappings(); 47 48 return workspace_tree_model; 49 } 50 51 52 static private void loadWebCacheMappings() 53 { 54 // If mirroring is enabled show the public and private caches 55 public_web_cache_mapping = MirrorPane.getPublicWebCacheMapping(); 56 if (public_web_cache_mapping != null) { 57 workspace_tree_root.insert(public_web_cache_mapping); 58 } 59 private_web_cache_mapping = MirrorPane.getPrivateWebCacheMapping(); 60 if (private_web_cache_mapping != null) { 61 workspace_tree_root.insert(private_web_cache_mapping); 62 } 63 } 64 65 66 static private void loadCollectionSpecificMappings() 67 { 68 // Add the current collection specific mappings 52 69 collection_specific_mappings = CollectionManager.getCollectionSpecificMappings(); 53 70 if (collection_specific_mappings != null) { … … 58 75 } 59 76 } 60 61 return workspace_tree_model;62 77 } 63 78 64 79 80 // !! NEEDS WORK !! 65 81 static public void refreshGreenstoneCollectionsMapping() 66 82 { 83 ((FileSystemModel) workspace_tree_model).refresh( 67 84 greenstone_collections_mapping.unmap(); 68 85 greenstone_collections_mapping.map(); … … 70 87 71 88 89 // !! NEEDS WORK !! 90 static public void refreshWebCacheMappings() 91 { 92 if (public_web_cache_mapping != null) { 93 SynchronizedTreeModelTools.removeNodeFromParent(workspace_tree_model, 94 public_web_cache_mapping); 95 } 96 if (private_web_cache_mapping != null) { 97 SynchronizedTreeModelTools.removeNodeFromParent(workspace_tree_model, 98 private_web_cache_mapping); 99 } 100 101 loadWebCacheMappings(); 102 } 103 104 105 // !! NEEDS WORK !! 72 106 static public void refreshCollectionSpecificMappings() 73 107 { … … 80 114 } 81 115 82 // Add the current collection specific mappings 83 collection_specific_mappings = CollectionManager.getCollectionSpecificMappings(); 84 if (collection_specific_mappings != null) { 85 for (int i = 0; i < collection_specific_mappings.length; i++) { 86 SynchronizedTreeModelTools.insertNodeInto(workspace_tree_model, 87 workspace_tree_root, 88 collection_specific_mappings[i]); 89 } 90 } 116 loadCollectionSpecificMappings(); 91 117 } 92 118 } -
trunk/gli/src/org/greenstone/gatherer/gui/MirrorPane.java
r5847 r5869 39 39 import java.awt.*; 40 40 import java.awt.event.*; 41 import java.io.File; 41 42 import java.net.*; 42 43 import javax.swing.*; … … 47 48 import org.greenstone.gatherer.Gatherer; 48 49 import org.greenstone.gatherer.WGet; 50 import org.greenstone.gatherer.file.FileNode; 49 51 import org.greenstone.gatherer.util.Utility; 50 52 … … 193 195 } 194 196 197 198 static public FileNode getPublicWebCacheMapping() 199 { 200 if (Gatherer.config.get("workflow.mirror", false)) { 201 return new FileNode(new File(Utility.CACHE_DIR), Dictionary.get("Tree.Public")); 202 } 203 204 return null; 205 } 206 207 208 static public FileNode getPrivateWebCacheMapping() 209 { 210 if (Gatherer.config.get("workflow.mirror", false) && Gatherer.c_man.ready()) { 211 return new FileNode(new File(Gatherer.c_man.getCollectionCache()), Dictionary.get("Tree.Private")); 212 } 213 214 return null; 215 } 216 217 195 218 private class DownloadButtonListener 196 219 implements ActionListener { -
trunk/gli/src/org/greenstone/gatherer/gui/tree/WorkspaceTree.java
r5854 r5869 55 55 if (refresh_reason == WorkspaceTree.MAPPED_DIRECTORIES_CHANGED) { 56 56 System.err.println("Reason: mapped directories changed."); 57 WorkspaceTreeModel.refreshWebCacheMappings(); 57 58 WorkspaceTreeModel.refreshCollectionSpecificMappings(); 59 updateUI(); 58 60 } 59 61 }
Note:
See TracChangeset
for help on using the changeset viewer.