Changeset 5854 for trunk/gli/src/org/greenstone/gatherer/gui
- Timestamp:
- 2003-11-16T17:50:12+13:00 (21 years ago)
- Location:
- trunk/gli/src/org/greenstone/gatherer/gui
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gli/src/org/greenstone/gatherer/gui/CollectionPane.java
r5847 r5854 244 244 collection_tree_sync.add(collection_tree); 245 245 246 refreshWorkspaceTree(DragTree. COLLECTION_CHANGED);247 refreshCollectionTree(DragTree. COLLECTION_CHANGED);246 refreshWorkspaceTree(DragTree.LOADED_COLLECTION_CHANGED); 247 refreshCollectionTree(DragTree.LOADED_COLLECTION_CHANGED); 248 248 249 249 // Enable or disable the control buttons … … 504 504 workspace_tree.refresh(refresh_reason); 505 505 } 506 507 508 /* public void refreshWorkspace() {509 System.err.println("CollectionPane::refreshWorkspace()... (ignored)");510 // workspace = Gatherer.c_man.getWorkspace();511 // workspace_tree.setModel(workspace);512 // workspace_tree_sync.add(workspace_tree);513 } */514 506 515 507 -
trunk/gli/src/org/greenstone/gatherer/gui/tree/DragTree.java
r5847 r5854 54 54 static private final int AUTOSCROLL_MARGIN = 12; 55 55 56 static public int COLLECTION_CHANGED = 1; 56 static public int LIBRARY_CONTENTS_CHANGED = 0; 57 static public int LOADED_COLLECTION_CHANGED = 1; 57 58 static public int COLLECTION_CONTENTS_CHANGED = 2; 58 59 static public int TREE_DISPLAY_CHANGED = 3; -
trunk/gli/src/org/greenstone/gatherer/gui/tree/WorkspaceTree.java
r5847 r5854 25 25 System.err.print("WorkspaceTree::refresh()... "); 26 26 27 // A collection has been opened/closed - reload the workspace tree model 28 if (refresh_reason == DragTree.COLLECTION_CHANGED) { 29 System.err.println("Reason: collection changed."); 27 // The collections in the library have changed - refresh the collect directory 28 if (refresh_reason == DragTree.LIBRARY_CONTENTS_CHANGED) { 29 System.err.println("Reason: library contents changed."); 30 String collect_directory_str = Gatherer.config.gsdl_path + Utility.COL_DIR; 31 refreshEveryNodeShowingFolder(collect_directory_str); 32 WorkspaceTreeModel.refreshGreenstoneCollectionsMapping(); 33 } 34 35 // A collection has been opened/closed - reload the whole shebang 36 if (refresh_reason == DragTree.LOADED_COLLECTION_CHANGED) { 37 System.err.println("Reason: loaded collection changed."); 30 38 setModel(WorkspaceTreeModel.getWorkspaceTreeModel()); 31 39 } 32 40 33 // The collection's contents have changed - refresh expanded parts of the collection41 // The collection's contents have changed - refresh collection's import folder 34 42 if (refresh_reason == DragTree.COLLECTION_CONTENTS_CHANGED) { 35 43 System.err.println("Reason: collection contents changed."); 36 37 44 String import_directory_str = Gatherer.c_man.getCollectionImport(); 38 39 TreePath tree_root_path = new TreePath(getModel().getRoot()); 40 Enumeration expanded_tree_paths = getExpandedDescendants(tree_root_path); 41 while (expanded_tree_paths.hasMoreElements()) { 42 TreePath expanded_tree_path = (TreePath) expanded_tree_paths.nextElement(); 43 FileNode tree_node = (FileNode) expanded_tree_path.getLastPathComponent(); 44 45 File tree_node_file = tree_node.getFile(); 46 if (tree_node_file == null) { 47 continue; 48 } 49 50 // Get the path of the open tree node 51 String tree_node_path_str = tree_node_file.toString(); 52 if (!tree_node_path_str.endsWith(File.separator)) { 53 tree_node_path_str = tree_node_path_str + File.separator; 54 } 55 56 // If the collection import directory is open, it must be refreshed 57 if (tree_node_path_str.equals(import_directory_str)) { 58 System.err.println("Must refresh collection import directory!"); 59 ((FileSystemModel) getModel()).refresh(expanded_tree_path); 60 } 61 } 45 refreshEveryNodeShowingFolder(import_directory_str); 62 46 } 63 47 … … 74 58 } 75 59 } 60 61 62 private void refreshEveryNodeShowingFolder(String folder_path_str) 63 { 64 // Search through the expanded tree paths, checking if any show the given folder 65 TreePath tree_root_path = new TreePath(getModel().getRoot()); 66 Enumeration expanded_tree_paths = getExpandedDescendants(tree_root_path); 67 while (expanded_tree_paths.hasMoreElements()) { 68 TreePath expanded_tree_path = (TreePath) expanded_tree_paths.nextElement(); 69 FileNode tree_node = (FileNode) expanded_tree_path.getLastPathComponent(); 70 71 File tree_node_file = tree_node.getFile(); 72 if (tree_node_file == null) { 73 continue; 74 } 75 76 // Get the path of the open tree node 77 String tree_node_path_str = tree_node_file.toString(); 78 if (!tree_node_path_str.endsWith(File.separator)) { 79 tree_node_path_str = tree_node_path_str + File.separator; 80 } 81 82 // If the collection import directory is open, it must be refreshed 83 if (tree_node_path_str.equals(folder_path_str)) { 84 System.err.println("Must refresh node " + tree_node_path_str + "!"); 85 ((FileSystemModel) getModel()).refresh(expanded_tree_path); 86 } 87 } 88 } 76 89 }
Note:
See TracChangeset
for help on using the changeset viewer.