Changeset 26638 for other-projects
- Timestamp:
- 2013-01-09T23:37:51+13:00 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
other-projects/GlamED/trunk/src/org/honours/CollectionSpace/CollectionSpace.java
r26608 r26638 14 14 import org.expeditee.items.Picture; 15 15 import org.expeditee.items.Text; 16 import org.honours.agents.GenerateThumbnails; 16 17 import org.honours.collection.Collection; 17 18 import org.honours.gui.HonoursFrameIO; … … 45 46 _associatedCollection = associatedCollection; 46 47 _name = "collectionspace-" + _associatedCollection.getName(); 47 _thumbnailsDirectory = FrameIO.IMAGES_FOLDER+ "thumbnails-" +48 _thumbnailsDirectory = "expeditee" + File.separator + "thumbnails-" + 48 49 _associatedCollection.getName(); 49 50 } … … 78 79 try{ 79 80 80 if(_thumbnailsDirectory == null){ 81 82 MessageBay.errorMessage("ERROR: No thumbnails directory set up so" + 83 " cannot generate CollectionSpace"); 84 85 return; 86 } 87 88 //generate actual collectionSpace frameset using _name. 89 createCollectionSpace(); 90 91 //Open thumbnails.info file. 92 BufferedReader br = new BufferedReader(new FileReader( 93 _thumbnailsDirectory + File.separator + 94 "thumbnails.info")); 95 String line; 96 97 while((line = br.readLine()) != null){ 98 99 String[] split = line.split(","); 100 101 //1st entry in split is filename, 2nd is associated frame name. 102 Text imageSource = new Text("@i: " + split[0] + " 1.0"); 103 Picture newPic = PictureInformation.getPicture(imageSource); 104 newPic.setLink(split[1]); 105 _thumbnails.add(newPic); 106 } 107 br.close(); 108 109 writeThumbnails(); 110 111 MessageBay.displayMessage("Collection Space generated!"); 112 113 Navigation.Goto(_name + "1"); 114 115 }catch(Exception e){ 116 e.printStackTrace(); 117 } 81 if(_thumbnailsDirectory == null){ 82 83 MessageBay.errorMessage("ERROR: No thumbnails directory set up so cannot generate CollectionSpace. Try running the GenerateThumbnails agent first before generating the Collection Space."); 84 85 return; 86 } 87 88 if(!new File(_thumbnailsDirectory).exists()){ 89 GenerateThumbnails gt = new GenerateThumbnails(); 90 Frame toLoad = FrameIO.LoadFrame(_associatedCollection + "1"); 91 System.err.println("*** _associatedCollection = " + _associatedCollection); 92 System.err.println("*** toLoad = " + toLoad); 93 gt.process(FrameIO.LoadFrame(_associatedCollection.getName() + "1")); 94 } 95 96 //generate actual collectionSpace frameset using _name. 97 createCollectionSpace(); 98 99 //Open thumbnails.inf file. 100 BufferedReader br = new BufferedReader(new FileReader( 101 _thumbnailsDirectory + File.separator + 102 "thumbnails.inf")); 103 String line; 104 105 while((line = br.readLine()) != null){ 106 107 String[] split = line.split(","); 108 109 //1st entry in split is filename, 2nd is associated frame name. 110 Text imageSource = new Text("@i: " + split[0] + " 1.0"); 111 Picture newPic = PictureInformation.getPicture(imageSource); 112 113 //Remove "thumbnail." from value in split[1]. 114 //String picLink = split[1].substring("thumbnail.".length()); 115 116 newPic.setLink(split[1]); 117 //newPic.setLink(picLink); 118 _thumbnails.add(newPic); 119 } 120 br.close(); 121 122 writeThumbnails(); 123 124 MessageBay.displayMessage("Collection Space generated!"); 125 126 Navigation.Goto(_name + "1"); 127 128 }catch(Exception e){ 129 e.printStackTrace(); 130 } 118 131 119 132 }
Note:
See TracChangeset
for help on using the changeset viewer.