Changeset 9039
- Timestamp:
- 2005-02-15T12:11: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/Gatherer.java
r9034 r9039 69 69 /** All of the external applications that must exit before we close the Gatherer. */ 70 70 public Vector apps = new Vector(); 71 static public String open_collection_file_path = null; 71 72 /** A public reference to the FileAssociationManager. */ 72 73 static public FileAssociationManager assoc_man; … … 310 311 } 311 312 312 // If there was an open collection last session, reopen it.313 if (open_collection == null) {314 open_collection = Configuration.getString("general.open_collection", true);315 } 316 if ( !no_load && open_collection.length() > 0) {317 c_man.loadCollection(open_collection);313 open_collection_file_path = open_collection; 314 if (open_collection_file_path == null) { 315 open_collection_file_path = Configuration.getString("general.open_collection", true); 316 } 317 if (no_load || open_collection_file_path.equals("")) { 318 open_collection_file_path = null; 318 319 } 319 320 } -
trunk/gli/src/org/greenstone/gatherer/GathererApplet.java
r8651 r9039 171 171 go.servlet_path, go.wget_version_str, go.wget_path); 172 172 173 174 173 JButton bttn = new JButton("Launch Greenstone Librarian Interface ..."); 175 174 bttn.addActionListener(this); … … 204 203 205 204 gatherer.run(size, splash, g_man); 205 206 // If there was an open collection last session, reopen it. 207 if (Gatherer.open_collection_file_path != null) { 208 Gatherer.c_man.loadCollection(Gatherer.open_collection_file_path); 209 } 206 210 } 207 211 -
trunk/gli/src/org/greenstone/gatherer/GathererProg.java
r8629 r9039 95 95 go.servlet_path, go.wget_version_str, go.wget_path); 96 96 gatherer.run(size,splash,g_man); 97 98 // If there was an open collection last session, reopen it. 99 if (Gatherer.open_collection_file_path != null) { 100 Gatherer.c_man.loadCollection(Gatherer.open_collection_file_path); 101 } 97 102 } 98 103 } -
trunk/gli/src/org/greenstone/gatherer/collection/CollectionManager.java
r9036 r9039 53 53 import org.greenstone.gatherer.cdm.CollectionMetaManager; 54 54 import org.greenstone.gatherer.cdm.CommandTokenizer; 55 import org.greenstone.gatherer.gui.ExternalCollectionPrompt; 55 56 import org.greenstone.gatherer.gui.LockFileDialog; 57 import org.greenstone.gatherer.gui.ModalProgressPopup; 56 58 import org.greenstone.gatherer.gui.NewCollectionMetadataPrompt; 57 import org.greenstone.gatherer.gui.ExternalCollectionPrompt;58 59 import org.greenstone.gatherer.gui.WarningDialog; 59 60 import org.greenstone.gatherer.metadata.DocXMLFileManager; … … 317 318 collect_dir.mkdirs(); 318 319 } 319 // Create a progress monitor. 320 ProgressMonitor progress = new ProgressMonitor(Gatherer.g_man, Dictionary.get("CollectionManager.Creating_New"), "mkcol.pl", 0, 7); 320 321 // Create a progress monitor 322 ProgressMonitor progress = new ProgressMonitor(Gatherer.g_man, Dictionary.get("CollectionManager.Creating_New"), "mkcol.pl", 0, 4); 323 321 324 // Create the new collection. 322 325 makeCollection(description, email, name, title); 326 progress.setProgress(1); 323 327 324 328 // ******************* … … 337 341 return; 338 342 } 339 progress.setProgress(1);340 343 341 344 // ACTIVE_DIR/log/ … … 343 346 File log_dir = log_dir_temp.getParentFile(); 344 347 log_dir.mkdirs(); 345 if(progress != null) { 346 progress.setNote(Dictionary.get("CollectionManager.Log_Created")); 347 } 348 progress.setNote(Dictionary.get("CollectionManager.Log_Created")); 348 349 349 350 // Make sure an import folder exists … … 369 370 ProfileXMLFileManager.loadProfileXMLFile(new File(collection_dir, Utility.META_DIR)); 370 371 371 // Before we create the CollectionDesignManager we have to check if we are basing it upon some other collection.372 // Before creating the CollectionDesignManager check if we are basing it upon some other collection 372 373 if (base_collection_directory != null) { 373 374 DebugStream.println("Basing new collection on existing one: " + base_collection_directory); … … 460 461 out = null; 461 462 462 progress.setProgress( 7);463 progress.setProgress(4); 463 464 progress.setNote(Dictionary.get("CollectionManager.Session_Ready", name)); 464 465 progress.close(); … … 809 810 } 810 811 812 813 public void loadCollection(String collection_file_path) 814 { 815 ModalProgressPopup load_collection_progress_popup = new ModalProgressPopup(Dictionary.get("CollectionManager.Loading_Collection")); 816 LoadCollectionTask load_collection_task = new LoadCollectionTask(collection_file_path, load_collection_progress_popup); 817 load_collection_task.start(); 818 load_collection_progress_popup.display(); // Blocks, so must go *after* starting the task! 819 } 820 821 822 private class LoadCollectionTask 823 extends Thread 824 { 825 private String collection_file_path = null; 826 private ModalProgressPopup load_collection_progress_popup = null; 827 828 public LoadCollectionTask(String collection_file_path, ModalProgressPopup load_collection_progress_popup) 829 { 830 this.collection_file_path = collection_file_path; 831 this.load_collection_progress_popup = load_collection_progress_popup; 832 } 833 834 public void run() 835 { 836 loadCollectionInternal(collection_file_path); 837 load_collection_progress_popup.setVisible(false); 838 } 839 } 840 841 811 842 /** Attempts to load the given collection. Currently uses simple serialization of the collection class. 812 843 * @param location The path to the collection as a <strong>String</strong>. … … 816 847 * @see org.greenstone.gatherer.util.Utility 817 848 */ 818 p ublic boolean loadCollection(String location)849 private void loadCollectionInternal(String location) 819 850 { 820 851 DebugStream.println("Loading collection " + location + "..."); 821 boolean non_g atherer_collection = false;852 boolean non_gli_collection = false; 822 853 823 854 // Check we have actually been given a .col file. … … 825 856 JOptionPane.showMessageDialog(Gatherer.g_man, Dictionary.get("CollectionManager.Not_Col_File", location), Dictionary.get("General.Error"), JOptionPane.ERROR_MESSAGE); 826 857 DebugStream.println("CollectionManager.loadCollection: Haven't been given a .col file."); 827 return false;858 return; 828 859 } 829 860 … … 835 866 // we cant open this 836 867 collection_directory = null; 837 return false;868 return; 838 869 } 839 870 File collection_config_file = new File(collection_directory, Utility.CONFIG_FILE); … … 842 873 collection_directory = null; 843 874 collection_config_file = null; 844 return false;875 return; 845 876 } 846 877 … … 849 880 if (!collection_metadata_directory.exists()) { 850 881 DebugStream.println("Loading non-gatherer collection..."); 851 non_g atherer_collection = true;882 non_gli_collection = true; 852 883 } 853 884 … … 866 897 collection_directory = null; 867 898 collection_config_file = null; 868 return false;899 return; 869 900 } 870 901 … … 872 903 } 873 904 874 boolean result = false;875 905 try { 876 906 // Create a lock file. … … 885 915 JOptionPane.showMessageDialog(Gatherer.g_man, Dictionary.get("CollectionManager.Cannot_Open_With_Reason", args), Dictionary.get("General.Error"), JOptionPane.ERROR_MESSAGE); 886 916 args = null; 887 return false;917 return; 888 918 } 889 919 … … 905 935 906 936 // If this is a non-GLI (legacy) collection, ask the user to choose some metadata sets 907 if (non_g atherer_collection) {937 if (non_gli_collection) { 908 938 if (!addSomeMetadataSets(collection_directory)) { 909 939 lock_file = null; 910 940 collection_directory = null; 911 941 closeCollection(); 912 return false;942 return; 913 943 } 914 944 … … 928 958 929 959 collection.cdm = new CollectionDesignManager(collection_config_file); 930 if (non_g atherer_collection) {960 if (non_gli_collection) { 931 961 // Change the classifiers to use the namespaced element names 932 962 LegacyCollectionImporter.updateClassifiers(collection.cdm); 933 963 } 934 964 935 // Tell everyone that it worked.965 // We're done. Let everyone know. 936 966 DebugStream.println(Dictionary.get("CollectionManager.Loading_Successful", name)); 937 938 // We're done. Let everyone know.939 967 Gatherer.refresh(Gatherer.COLLECTION_OPENED); 940 result = true;941 968 } 942 969 catch (Exception error) { … … 957 984 collection_directory = null; 958 985 collection_config_file = null; 959 960 return result;961 986 } 962 987
Note:
See TracChangeset
for help on using the changeset viewer.