Changeset 8600
- Timestamp:
- 2004-11-18T16:29:37+13:00 (19 years ago)
- Location:
- trunk/gli/src/org/greenstone/gatherer
- Files:
-
- 1 added
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gli/src/org/greenstone/gatherer/cdm/PlugInManager.java
r8249 r8600 41 41 import org.greenstone.gatherer.Dictionary; 42 42 import org.greenstone.gatherer.Gatherer; 43 import org.greenstone.gatherer.collection.CollectionContentsChangedListener; 43 44 import org.greenstone.gatherer.gui.GComboBox; 44 45 import org.greenstone.gatherer.gui.GLIButton; … … 51 52 /** This class is for maintaining a list of known plug-ins, and importing new plugins using the parser. */ 52 53 public class PlugInManager 53 extends DOMProxyListModel { 54 extends DOMProxyListModel 55 implements CollectionContentsChangedListener 56 { 54 57 /** The library 'reserve' of base plugins. */ 55 58 private ArrayList library = null; … … 72 75 // Create the separator, cause we can reuse it. 73 76 separator = getSeparator(); 77 78 // Listen for CollectionContentsChanged events, so we can give plugin hints when new files are added 79 Gatherer.c_man.addCollectionContentsChangedListener(this); 74 80 } 75 81 … … 104 110 return true; 105 111 } 112 113 106 114 /** Destructor. */ 107 115 public void destroy() { … … 113 121 library = null; 114 122 } 123 124 125 public void fileAddedToCollection(File file) 126 { 127 System.err.println("New file added to collection: " + file); 128 129 // First check the plugins already assigned in the collection 130 for (int i = 0; i < super.getSize(); i++) { 131 PlugIn assigned_plugin = (PlugIn) getElementAt(i); 132 if (assigned_plugin.isSeparator() == false) { 133 System.err.println("Assigned plugin: " + assigned_plugin); 134 } 135 } 136 137 // System.err.println("Number of plugins assigned in the collection: " + super.getSize()); 138 System.err.println("Number of plugins loaded: " + library.size()); 139 } 140 115 141 116 142 /** Method to retrieve the control for this manager. -
trunk/gli/src/org/greenstone/gatherer/collection/CollectionManager.java
r8597 r8600 89 89 /** Are we currently in the process of importing? */ 90 90 private boolean importing = false; 91 /** The objects listening for CollectionContentsChanged events. */ 92 private ArrayList collection_contents_changed_listeners = new ArrayList(); 91 93 /** The collection this manager is managing! */ 92 94 static private Collection collection = null; … … 118 120 this.importing = false; 119 121 this.collection = null; 122 } 123 124 125 public void addCollectionContentsChangedListener(CollectionContentsChangedListener listener) 126 { 127 collection_contents_changed_listeners.add(listener); 120 128 } 121 129 … … 517 525 catch (Exception error) { 518 526 DebugStream.printStackTrace(error); 527 } 528 } 529 530 531 public void fireFileAddedToCollection(File file) 532 { 533 // Send the event off to all the CollectionContentsChangedListeners 534 for (int i = 0; i < collection_contents_changed_listeners.size(); i++) { 535 ((CollectionContentsChangedListener) collection_contents_changed_listeners.get(i)).fileAddedToCollection(file); 519 536 } 520 537 } -
trunk/gli/src/org/greenstone/gatherer/file/FileQueue.java
r8599 r8600 161 161 public LongProgressBar getProgressBar() { 162 162 return progress; 163 }164 /** Prevent the progress bar updating momentarily, while its size is re-adjusted. */165 public void pause() {166 progress.setIndeterminate(true);167 163 } 168 164 … … 353 349 DebugStream.printStackTrace(exception); 354 350 } 355 // If not cancelled 356 if(!cancel_action) { 357 // Step one is to create a dummy FileNode. Its important it has the correct structure so getPath works. 358 FileNode new_record = new FileNode(target_file); 359 SynchronizedTreeModelTools.insertNodeInto(target_model, destination_node, new_record); 360 new_node = new_record; 361 new_record = null; 351 // If not cancelled 352 if (!cancel_action) { 353 // Create a dummy FileNode with the correct structure (so getPath works) 354 new_node = new FileNode(target_file); 355 SynchronizedTreeModelTools.insertNodeInto(target_model, destination_node, new_node); 362 356 } 363 357 } … … 403 397 source_model.refresh(new TreePath(((FileNode)origin_node.getParent()).getPath())); 404 398 } 405 406 // We can't have been cancelled, and we must have created a new FileNode during the above phase, before we can handle metadata.399 400 // If we haven't been cancelled and we created a new FileNode during the above phase, now is the time to deal with metadata 407 401 if (!cancel_action && new_node != null) { 408 /* Time to handle any existing metadata. */ 409 // If the directory came from inside our collection... 402 // If the file came from inside our collection... 410 403 if (job.source.toString().equals("Collection")) { 411 // System.err.println("Move within collection...");412 413 404 // Get the non-folder level metadata assigned to the origin node... 414 405 ArrayList assigned_metadata = MetadataXMLFileManager.getMetadataAssignedDirectlyToFile(source_file); … … 426 417 MetadataValue metadata_value = (MetadataValue) assigned_metadata.get(i); 427 418 MetadataXMLFileManager.addMetadata(new_node, metadata_value); 428 } 419 } 420 } 421 422 if (job.type == FileJob.COPY) { 423 Gatherer.c_man.fireFileAddedToCollection(new_node.getFile()); 429 424 } 430 425 } -
trunk/gli/src/org/greenstone/gatherer/gui/GatherPane.java
r8595 r8600 478 478 collection_tree.refresh(null); 479 479 } 480 480 481 481 482 482 public void refreshWorkspaceTree(int refresh_reason) {
Note:
See TracChangeset
for help on using the changeset viewer.