Changeset 1244
- Timestamp:
- 03/17/19 22:29:23 (5 years ago)
- Location:
- trunk
- Files:
-
- 1 added
- 23 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/META-INF/MANIFEST.MF
r1103 r1244 150 150 org.expeditee.assets.icons, 151 151 org.expeditee.assets.images, 152 org.expeditee.assets.resources.dict,153 org.expeditee.assets.resources.documentation.calculatetest,154 org.expeditee.assets.resources.documentation.demo,155 org.expeditee.assets.resources.documentation.documentation,156 org.expeditee.assets.resources.documentation.expediteetest,157 org.expeditee.assets.resources.documentation.framesetthatdoesntexist,158 org.expeditee.assets.resources.documentation.simpledoc,159 org.expeditee.assets.resources.documentation.simpletest,160 org.expeditee.assets.resources.documentation.simpletestsuite,161 org.expeditee.assets.resources.documentation.tutorials,162 org.expeditee.assets.resources.fonts.Amaranth,163 org.expeditee.assets.resources.fonts.DejaVu,164 org.expeditee.assets.resources.fonts.FontAwesome,165 org.expeditee.assets.resources.fonts.Metamorphous,166 org.expeditee.assets.resources.fonts.RobotoCondensed,167 org.expeditee.assets.resources.framesets.exploratorysearch,168 org.expeditee.assets.resources.framesets.javascript,169 org.expeditee.assets.resources.framesets.overlayset,170 org.expeditee.assets.resources.framesets.platonicforms,171 org.expeditee.assets.resources.framesets.pong,172 org.expeditee.assets.resources.framesets.webbrowser,173 org.expeditee.assets.resources.images,174 152 org.expeditee.assets.scripts.browserreadablemode, 175 153 org.expeditee.assets.style, -
trunk/src/org/apollo/ApolloSystem.java
r1242 r1244 18 18 import org.apollo.gui.FramePlaybackBarRenderer; 19 19 import org.apollo.gui.FrameRenderPasses; 20 import org.apollo.io.AudioPathManager; 20 21 import org.apollo.io.SampledAudioFileImporter; 21 22 import org.apollo.util.ApolloSystemLog; … … 260 261 Browser.main(args); 261 262 262 // Initialize apollo 263 EcosystemManager.getMiscManager().runOnGIOThread(new BlockingRunnable() { 264 public void execute() { 265 ApolloSystem.initialize(); 266 } 267 }); 263 if (!Boolean.getBoolean("auth")) { 264 // If not running with authentication/login, then proceed with initializing Apollo 265 EcosystemManager.getMiscManager().runOnGIOThread(new BlockingRunnable() { 266 public void execute() { 267 ApolloSystem.initialize(); 268 } 269 }); 270 } 268 271 } 269 272 -
trunk/src/org/apollo/agents/MelodySearch.java
r1102 r1244 452 452 String fullPath = null; 453 453 if (path == null) { 454 for (String possiblePath : FolderSettings.FrameDirs.get ()) {454 for (String possiblePath : FolderSettings.FrameDirs.getAbsoluteDirs()) { 455 455 fullPath = FrameIO.getFrameFullPathName(possiblePath, frameName); 456 456 if (fullPath != null) -
trunk/src/org/apollo/audio/structure/AudioStructureModel.java
r1142 r1244 289 289 290 290 String fullPath = null; 291 for (int i = 0; i < FolderSettings.FrameDirs.get().size(); i++) { // RISKY CODE - IN EXPEDITEE SPACE FROM RANDOM TRHEAD 292 String possiblePath = FolderSettings.FrameDirs.get().get(i); 291 List<String> possiblePaths = FolderSettings.FrameDirs.getAbsoluteDirs(); 292 293 for (int i = 0; i < possiblePaths.size(); i++) { // RISKY CODE - IN EXPEDITEE SPACE FROM RANDOM TRHEAD 294 String possiblePath = possiblePaths.get(i); 293 295 fullPath = FrameIO.getFrameFullPathName(possiblePath, rootFrameName); 294 296 if (fullPath != null) -
trunk/src/org/apollo/io/AudioPathManager.java
r1023 r1244 12 12 import org.apollo.util.ApolloSystemLog; 13 13 import org.apollo.util.RegExpFileFilter; 14 14 import org.expeditee.gui.Browser; 15 15 import org.expeditee.gui.FrameIO; 16 import org.expeditee.settings.UserSettings; 16 17 17 18 /** … … 28 29 29 30 /** Suffixed with the native file separator */ 30 public static String AUDIO_HOME_DIRECTORY = "audio" + File.separatorChar;31 public static String AUDIO_HOME_DIRECTORY = null; 31 32 32 33 /** Stores all virtual names created by this repository. */ … … 39 40 private static Random rand = new Random(System.currentTimeMillis()); 40 41 41 /** 42 * Class initializer. 43 * Ensures that the home directory(ies) exist and preps the counter 44 */ 45 static { 46 String expeditee_home = System.getProperty("expeditee.home"); 47 48 /* 49 if (expeditee_home != null) { 50 AUDIO_HOME_DIRECTORY = expeditee_home + File.separator + AUDIO_HOME_DIRECTORY; 51 }*/ 52 AUDIO_HOME_DIRECTORY = FrameIO.PARENT_FOLDER + AUDIO_HOME_DIRECTORY; 53 //System.err.println("*** audio_home_dir = " + AUDIO_HOME_DIRECTORY); 42 // **** DB 43 // Some work to be done here => remove dependency in code on 'AUDIO_HOME_DIRECTORY' 44 // and change it to use audio dir list from UserSettings 45 public static void changeParentAndSubFolders(String newFolder) { 46 47 if (Boolean.getBoolean("auth") && System.getProperty("user.name").equals(Browser.USER_NOBODY)) { 48 System.err.println("**** AudioPathManager::changeParentAndSubFolder(): Nothing to do for user '" + Browser.USER_NOBODY + "'"); 49 return; 50 } 51 52 if (UserSettings.PublicAndPrivateResources) { 53 //String resourcesPublicPath = FrameIO.PARENT_FOLDER + "resources-public" + File.separator; 54 String userName = UserSettings.UserName.get(); 55 //String resourcesPrivateIndividualPath = FrameIO.PARENT_FOLDER + "resources-" + userName + File.separator; 56 if (Boolean.getBoolean("auth")) { 57 System.err.println("**** AudioPathManager::changeParentAndSubFolder(): Setting 'audio' folder to resources-" + userName); 58 } 59 //AUDIO_HOME_DIRECTORY = resourcesPrivateIndividualPath + "audio" + File.separatorChar; 60 AUDIO_HOME_DIRECTORY = FrameIO.AUDIO_PRIVATE_PATH; 61 } 62 else { 63 AUDIO_HOME_DIRECTORY = FrameIO.PARENT_FOLDER + "audio" + File.separatorChar;; 64 } 65 } 66 67 public static void activateAndScanAudioDir() 68 { 69 changeParentAndSubFolders(FrameIO.PARENT_FOLDER); 54 70 55 71 // Ensure audio directory exists … … 62 78 63 79 // Load counter 64 loadCounter(dir); 65 } 66 80 loadCounter(AUDIO_HOME_DIRECTORY); 81 } 82 83 67 84 /** 68 85 * Loads the counter 69 86 * @param dir The dir where the audio files live. 70 87 */ 71 private static void loadCounter(File dir) { 72 String[] files = getAudioFileNames(dir); 88 private static void loadCounter(String audio_dir_str) { 89 File audio_dir = new File(audio_dir_str); 90 91 String[] files = getAudioFileNames(audio_dir); 73 92 if (files == null) { // Due to IO exception 74 93 ApolloSystemLog.printError("Failed to read audio directory"); … … 89 108 } 90 109 91 if (start >= 0 && end == -1) end = f.length(); 110 if (start >= 0 && end == -1) { 111 end = f.length(); 112 } 92 113 93 114 if (start > 0 && end >= start) { // not start >= 0 since missing preable -
trunk/src/org/apollo/util/AudioPurger.java
r1102 r1244 33 33 Set<String> referencedAudio = new HashSet<String>(); 34 34 35 for (String path : FolderSettings.FrameDirs.get ()) {35 for (String path : FolderSettings.FrameDirs.getAbsoluteDirs()) { 36 36 37 37 File frameDir = new File(path); -
trunk/src/org/expeditee/actions/Spelling.java
r919 r1244 46 46 } 47 47 if (path == null) { 48 for (String possiblePath : FolderSettings.FrameDirs.get()) { 49 fullPath = FrameIO 50 .getFrameFullPathName(possiblePath, frameName); 48 for (String possiblePath : FolderSettings.FrameDirs.getAbsoluteDirs()) { 49 fullPath = FrameIO.getFrameFullPathName(possiblePath, frameName); 51 50 if (fullPath != null) 52 51 break; -
trunk/src/org/expeditee/agents/SearchTree.java
r919 r1244 88 88 89 89 String fullPath = null; 90 for (String possiblePath : FolderSettings.FrameDirs.get ()) {90 for (String possiblePath : FolderSettings.FrameDirs.getAbsoluteDirs()) { 91 91 fullPath = FrameIO.getFrameFullPathName(possiblePath, frameName); 92 92 if (fullPath != null) -
trunk/src/org/expeditee/agents/SearchTreeNoResults.java
r919 r1244 71 71 72 72 String fullPath = null; 73 for (String possiblePath : FolderSettings.FrameDirs.get ()) {73 for (String possiblePath : FolderSettings.FrameDirs.getAbsoluteDirs()) { 74 74 fullPath = FrameIO.getFrameFullPathName(possiblePath, frameName); 75 75 if (fullPath != null) -
trunk/src/org/expeditee/auth/Actions.java
r1243 r1244 39 39 import javax.crypto.spec.SecretKeySpec; 40 40 41 import org.apollo.ApolloSystem; 42 import org.apollo.io.AudioPathManager; 41 43 import org.expeditee.agents.ExistingFramesetException; 42 44 import org.expeditee.agents.InvalidFramesetNameException; … … 45 47 import org.expeditee.auth.tags.AuthenticationTag; 46 48 import org.expeditee.auth.tags.Constants; 49 import org.expeditee.core.BlockingRunnable; 47 50 import org.expeditee.core.Colour; 51 import org.expeditee.gio.EcosystemManager; 48 52 import org.expeditee.gui.DisplayController; 49 53 import org.expeditee.gui.Frame; … … 374 378 375 379 // Update in memory settings 380 System.setProperty("user.name", username); 376 381 UserSettings.UserName.set(username); 377 382 UserSettings.ProfileName.set(username); … … 388 393 initialSettings.put("org.expeditee.gui.folders.FolderSettings.FrameDirs", FolderSettings.FrameDirs); 389 394 initialSettings.put("org.expeditee.gui.folders.FolderSettings.ImageDirs", FolderSettings.ImageDirs); 390 395 initialSettings.put("org.expeditee.gui.folders.FolderSettings.AudioDirs", FolderSettings.AudioDirs); 396 391 397 // Create users profile 392 398 Frame profile = FrameIO.CreateNewProfile(username, initialSettings); … … 447 453 448 454 // Copy private resources to personal area 449 Path personalResources = Paths.get(FrameIO.PARENT_FOLDER).resolve("resources-" + username); 450 personalResources.toFile().mkdir(); 451 File[] globalResourcesToCopy = Paths.get(FrameIO.RESOURCES_PRIVATE).toFile().listFiles(); 452 for (File toCopy: globalResourcesToCopy) { 453 Path p = Paths.get(toCopy.getAbsolutePath()); 454 if (!p.getFileName().toString().equals(".res") && !p.getFileName().toString().equals("about")) { 455 copyFileTree(p.toAbsolutePath(), personalResources.resolve(p.getFileName())); 456 } 457 } 455 Path personalResources = FrameIO.setupPersonalResources(username); 456 458 457 File contactsDir = new File(personalResources.resolve("contacts").toAbsolutePath().toString()); 459 458 contactsDir.mkdir(); 460 459 460 System.err.println("**** Hardwired call in Apollo's AuthioPathManager"); 461 AudioPathManager.activateAndScanAudioDir(); // **** 462 461 463 System.out.println(message + "Done."); 462 464 } 463 465 464 private static void copyFileTree(Path source, Path target) throws IOException { 465 Files.copy(source, target); 466 if (source.toFile().isDirectory()) { 467 File[] files = source.toFile().listFiles(); 468 for (File file: files) { 469 Path asPath = Paths.get(file.getAbsolutePath()); 470 copyFileTree(asPath, target.resolve(asPath.getFileName())); 471 } 472 } 473 } 466 474 467 475 468 /* … … 486 479 return; 487 480 } 481 482 // **** DB 483 // Have not been able to test the following as auth + login not currently working 484 // 'out of the box' 485 486 // initialize Apollo 487 //EcosystemManager.getMiscManager().runOnGIOThread(new BlockingRunnable() { 488 //public void execute() { 489 ApolloSystem.initialize(); 490 //} 491 //}); 492 488 493 489 494 // Load in and cache the profile frame using the personal key fetched from keystore. -
trunk/src/org/expeditee/auth/Authenticator.java
r1243 r1244 180 180 } 181 181 182 final SecretKey getSecretKey(final String label, final String password) throws NoSuchAlgorithmException, KeyStoreException { 183 final KeyStore.ProtectionParameter entryPassword = new KeyStore.PasswordProtection(password.toCharArray()); 184 KeyStore.SecretKeyEntry entry = null; 182 final SecretKey getSecretKey(final String label, final String password) throws NoSuchAlgorithmException, KeyStoreException { 183 184 char[] password_ca = password.toCharArray(); 185 final KeyStore.ProtectionParameter entryPassword = new KeyStore.PasswordProtection(password_ca); 186 187 SecretKey secret_key; 185 188 try { 186 entry = (SecretKeyEntry) keyStore.getEntry(label, entryPassword); 189 SecretKeyEntry entry = (SecretKeyEntry) keyStore.getEntry(label, entryPassword); 190 secret_key = entry.getSecretKey(); 191 187 192 } catch (final UnrecoverableEntryException e) { 188 entry = null;189 } 190 if (entry == null) { return null; }191 else { return entry.getSecretKey(); }193 secret_key = null; 194 } 195 196 return secret_key; 192 197 } 193 198 -
trunk/src/org/expeditee/gui/Browser.java
r1242 r1244 22 22 import java.io.IOException; 23 23 import java.net.Authenticator; 24 import java.nio.file.Path; 24 25 import java.security.KeyStoreException; 25 26 import java.security.NoSuchAlgorithmException; … … 148 149 public static boolean _hasExited = false; 149 150 151 public static String USER_NOBODY = "nobody"; 152 150 153 /** A flag which is set once the application is exiting. */ 151 154 protected boolean _isExiting = false; … … 154 157 155 158 private static String _startFrame = null; 159 156 160 157 161 /** … … 162 166 public static void main(String[] args) 163 167 { 168 if (Boolean.getBoolean("auth")) { 169 String starting_user_name = System.getProperty("user.name"); 170 System.setProperty("startinguser.name", starting_user_name); 171 System.setProperty("user.name", USER_NOBODY); 172 } 173 164 174 // Parse the starting frame command-line argument 165 175 if(args.length > 0) { … … 261 271 Frame userProfile = loadProfiles(); 262 272 273 if (!Boolean.getBoolean("auth")) { 274 String userName = UserSettings.ProfileName.get(); 275 FrameIO.setupPersonalResources(userName); 276 } 263 277 // Listen for save status to display during and after runtime 264 278 EntitySaveManager.getInstance().addSaveStateChangedEventListener(this); -
trunk/src/org/expeditee/gui/DisplayController.java
r1216 r1244 68 68 RIGHT 69 69 } 70 70 71 // To help title calculations on frame 72 public static final int MINIMUM_FRAME_WIDTH = 512; 73 71 74 /** Convenience definition of TwinFramesSide.LEFT. */ 72 75 public static final TwinFramesSide LEFT = TwinFramesSide.LEFT; -
trunk/src/org/expeditee/gui/FrameIO.java
r1242 r1244 33 33 import java.io.Writer; 34 34 import java.nio.channels.FileChannel; 35 import java.nio.file.Files; 36 import java.nio.file.Path; 35 37 import java.nio.file.Paths; 36 38 import java.sql.Time; … … 43 45 import java.util.stream.Collectors; 44 46 47 import org.apollo.gui.IChangeParentAndSubFolders; 48 import org.apollo.io.AudioPathManager; 45 49 import org.expeditee.actions.Actions; 46 50 import org.expeditee.agents.ExistingFramesetException; … … 81 85 * 82 86 */ 87 88 83 89 public class FrameIO { 84 90 85 91 private static final char FRAME_NAME_LAST_CHAR = 'A'; 86 87 public static void changeParentFolder(String newFolder) {88 // Partial Paths.89 PARENT_FOLDER = newFolder;90 String resourcesPublicPath = PARENT_FOLDER + "resources-public" + File.separator;91 String resourcesPrivateIndividualPath = PARENT_FOLDER + "resources-" + UserSettings.UserName.get() + File.separator;92 93 // Standard paths.94 PUBLIC_PATH = PARENT_FOLDER + "public" + File.separator;95 MESSAGES_PATH = PARENT_FOLDER + "messages" + File.separator;96 TRASH_PATH = PARENT_FOLDER + "trash" + File.separator;97 HELP_PATH = PARENT_FOLDER + "documentation" + File.separator;98 PROFILE_PATH = PARENT_FOLDER + "profiles" + File.separator;99 EXPORTS_DIR = PARENT_FOLDER + "exports" + File.separator;100 STATISTICS_DIR = PARENT_FOLDER + "statistics" + File.separator;101 LOGS_DIR = PARENT_FOLDER + "logs" + File.separator;102 103 // New regime paths.104 if (UserSettings.multiUserMode) {105 SHARED_FRAMESETS_PATH = resourcesPrivateIndividualPath + "framesets-shared" + File.separator;106 RESOURCES_PRIVATE = PARENT_FOLDER + "resources-private" + File.separator;107 RESOURCES_PATH = resourcesPublicPath + "documentation" + File.separator;108 FRAME_PRIVATE_PATH = resourcesPrivateIndividualPath + "framesets" + File.separator;109 IMAGES_PRIVATE_PATH = resourcesPrivateIndividualPath + "images" + File.separator;110 CONTACTS_PATH = resourcesPrivateIndividualPath + "contacts" + File.separator;111 } else {112 // If we are using the old regime then these paths should not be used.113 SHARED_FRAMESETS_PATH = null;114 RESOURCES_PRIVATE = null;115 RESOURCES_PATH = null;116 FRAME_PRIVATE_PATH = null;117 IMAGES_PRIVATE_PATH = null;118 CONTACTS_PATH = null;119 }120 121 // Conditional paths122 if (UserSettings.multiUserMode) {123 FONT_PATH = resourcesPublicPath + "fonts" + File.separator;124 DICT_PATH = resourcesPublicPath + "dict" + File.separator;125 IMAGES_PATH = resourcesPublicPath + "images" + File.separator;126 FRAME_PATH = resourcesPublicPath + "framesets" + File.separator;127 } else {128 FONT_PATH = PARENT_FOLDER + "fonts" + File.separator;129 DICT_PATH = PARENT_FOLDER + "dict" + File.separator;130 IMAGES_PATH = PARENT_FOLDER + "images" + File.separator;131 FRAME_PATH = PARENT_FOLDER + "framesets" + File.separator;132 }133 }134 92 135 93 // The parent path that all others are relative to. Also referred to as Expeditee Home. … … 142 100 public static String MESSAGES_PATH; 143 101 public static String IMAGES_PATH; 102 public static String AUDIO_PATH; 144 103 public static String PUBLIC_PATH; 145 104 public static String TRASH_PATH; … … 159 118 public static String FRAME_PRIVATE_PATH; 160 119 public static String IMAGES_PRIVATE_PATH; 120 public static String AUDIO_PRIVATE_PATH; 161 121 162 122 // Paths used only by old regime. … … 175 135 176 136 private static final String INF_FILENAME = "frame.inf"; 137 138 public static void changeParentAndSubFolders(String newFolder) { 139 // Partial Paths. 140 PARENT_FOLDER = newFolder; 141 142 String resourcesPublicPath = PARENT_FOLDER + "resources-public" + File.separator; 143 144 // Standard paths. 145 PUBLIC_PATH = PARENT_FOLDER + "public" + File.separator; 146 MESSAGES_PATH = PARENT_FOLDER + "messages" + File.separator; 147 TRASH_PATH = PARENT_FOLDER + "trash" + File.separator; 148 HELP_PATH = PARENT_FOLDER + "documentation" + File.separator; 149 PROFILE_PATH = PARENT_FOLDER + "profiles" + File.separator; 150 EXPORTS_DIR = PARENT_FOLDER + "exports" + File.separator; 151 STATISTICS_DIR = PARENT_FOLDER + "statistics" + File.separator; 152 LOGS_DIR = PARENT_FOLDER + "logs" + File.separator; 153 154 155 // Conditional paths 156 if (UserSettings.PublicAndPrivateResources) { 157 // Work with a system of public and private folders 158 159 FONT_PATH = resourcesPublicPath + "fonts" + File.separator; 160 DICT_PATH = resourcesPublicPath + "dict" + File.separator; 161 IMAGES_PATH = resourcesPublicPath + "images" + File.separator; 162 AUDIO_PATH = resourcesPublicPath + "audio" + File.separator; 163 FRAME_PATH = resourcesPublicPath + "framesets" + File.separator; 164 } 165 else { 166 FONT_PATH = PARENT_FOLDER + "fonts" + File.separator; 167 DICT_PATH = PARENT_FOLDER + "dict" + File.separator; 168 IMAGES_PATH = PARENT_FOLDER + "images" + File.separator; 169 AUDIO_PATH = PARENT_FOLDER + "audio" + File.separator; 170 FRAME_PATH = PARENT_FOLDER + "framesets" + File.separator; 171 } 172 173 if (!UserSettings.PublicAndPrivateResources || System.getProperty("user.name").equals(Browser.USER_NOBODY)) { 174 175 if (System.getProperty("user.name").equals(Browser.USER_NOBODY)) { 176 System.err.println("**** FrameIO::changeParentAndSubFolders(): Not setting subfolders for user '"+Browser.USER_NOBODY+"'"); 177 } 178 179 // If we are using the old regime, or user.name set to Browser.USER_NOBODY 180 // => then these paths should not be used. 181 RESOURCES_PATH = null; 182 SHARED_FRAMESETS_PATH = null; 183 RESOURCES_PRIVATE = null; 184 FRAME_PRIVATE_PATH = null; 185 IMAGES_PRIVATE_PATH = null; 186 AUDIO_PRIVATE_PATH = null; 187 CONTACTS_PATH = null; 188 } 189 else { 190 String resourcesPrivateIndividualPath = PARENT_FOLDER + "resources-" + UserSettings.UserName.get() + File.separator; 191 192 RESOURCES_PATH = resourcesPublicPath + "documentation" + File.separator; 193 SHARED_FRAMESETS_PATH = resourcesPrivateIndividualPath + "framesets-shared" + File.separator; 194 195 RESOURCES_PRIVATE = PARENT_FOLDER + "resources-private" + File.separator; 196 FRAME_PRIVATE_PATH = resourcesPrivateIndividualPath + "framesets" + File.separator; 197 IMAGES_PRIVATE_PATH = resourcesPrivateIndividualPath + "images" + File.separator; 198 AUDIO_PRIVATE_PATH = resourcesPrivateIndividualPath + "audio" + File.separator; 199 CONTACTS_PATH = resourcesPrivateIndividualPath + "contacts" + File.separator; 200 } 201 202 203 System.err.println("**** FrameIO::changeParentAndSubFolder(): Calling AudioPathManger.changeParentAndSubFolder()"); 204 AudioPathManager.changeParentAndSubFolders(newFolder); 205 } 177 206 178 207 // All methods are static, this should not be instantiated … … 341 370 loaded = LoadKnownPath(knownPath, framename); 342 371 } else { 343 List<String> directoriesToSearch = FolderSettings.FrameDirs.get ();372 List<String> directoriesToSearch = FolderSettings.FrameDirs.getAbsoluteDirs(); 344 373 345 374 if (Authenticator.Authenticated) { … … 378 407 StringBuffer list = new StringBuffer(); 379 408 380 for (String path : FolderSettings.FrameDirs.get ()) {409 for (String path : FolderSettings.FrameDirs.getAbsoluteDirs()) { 381 410 File files = new File(path); 382 411 if (!files.exists()) { … … 466 495 } 467 496 468 for (String path : FolderSettings.FrameDirs.get ()) {497 for (String path : FolderSettings.FrameDirs.getAbsoluteDirs()) { 469 498 if (getFrameFullPathName(path, frameName) != null) { 470 499 return true; … … 478 507 String fullPath = null; 479 508 if (path == null) { 480 for (String possiblePath : FolderSettings.FrameDirs.get ()) {509 for (String possiblePath : FolderSettings.FrameDirs.getAbsoluteDirs()) { 481 510 fullPath = getFrameFullPathName(possiblePath, frameName); 482 511 if (fullPath != null) { … … 879 908 if (!DisplayController.isTwinFramesOn() && !Justification.center.equals(((Text)titleItem).getJustification())) { 880 909 if ((titleItem.getX() + 1) < template.getNameItem().getX()) { 881 while (titleItem.getSize() > Text.MINIMUM_FONT_SIZE 882 && titleItem.getBoundsWidth() + titleItem.getX() > template 883 .getNameItem().getX()) { 910 int title_item_xr = titleItem.getX() + titleItem.getBoundsWidth(); // should really be '... -1' 911 int frame_name_xl = template.getNameItem().getX(); 912 if (frame_name_xl < DisplayController.MINIMUM_FRAME_WIDTH) { 913 frame_name_xl = DisplayController.MINIMUM_FRAME_WIDTH; 914 } 915 916 while ((titleItem.getSize() > Text.MINIMUM_FONT_SIZE) && title_item_xr > frame_name_xl) { 884 917 titleItem.setSize(titleItem.getSize() - 1); 918 System.err.println("**** shrunk titleItem: " + titleItem + " to font size: " + titleItem.getSize()); 885 919 } 886 920 } else { … … 1544 1578 public static Boolean canAccessFrameset(String framesetName) { 1545 1579 framesetName = framesetName.toLowerCase(); 1546 for (String path : FolderSettings.FrameDirs.get ()) {1580 for (String path : FolderSettings.FrameDirs.getAbsoluteDirs()) { 1547 1581 if ((new File(path + framesetName)).exists()) { 1548 1582 return true; … … 1685 1719 1686 1720 // Search all the available directories for the directory 1687 for (String path : FolderSettings.FrameDirs.get ()) {1721 for (String path : FolderSettings.FrameDirs.getAbsoluteDirs()) { 1688 1722 String source = path + framesetName.toLowerCase() + File.separator; 1689 1723 File framesetDirectory = new File(source); … … 1730 1764 // search through all the directories to find the frameset we are 1731 1765 // copying 1732 for (String path : FolderSettings.FrameDirs.get ()) {1766 for (String path : FolderSettings.FrameDirs.getAbsoluteDirs()) { 1733 1767 String source = path + framesetToCopy.toLowerCase() 1734 1768 + File.separator; … … 1890 1924 toSave.setActiveTime(activeTime); 1891 1925 } 1926 1927 public static Path setupPersonalResources(String username) 1928 { 1929 Path personalResources = Paths.get(FrameIO.PARENT_FOLDER).resolve("resources-" + username); 1930 personalResources.toFile().mkdir(); 1931 File[] globalResourcesToCopy = Paths.get(FrameIO.RESOURCES_PRIVATE).toFile().listFiles(); 1932 1933 try { 1934 for (File toCopy: globalResourcesToCopy) { 1935 Path p = Paths.get(toCopy.getAbsolutePath()); 1936 if (!p.getFileName().toString().equals(".res") && !p.getFileName().toString().equals("about")) { 1937 copyFileTree(p.toAbsolutePath(), personalResources.resolve(p.getFileName())); 1938 } 1939 } 1940 } 1941 catch (IOException e) { 1942 e.printStackTrace(); 1943 personalResources = null; 1944 } 1945 1946 return personalResources; 1947 } 1948 1949 private static void copyFileTree(Path source, Path target) throws IOException { 1950 Files.copy(source, target); 1951 if (source.toFile().isDirectory()) { 1952 File[] files = source.toFile().listFiles(); 1953 for (File file: files) { 1954 Path asPath = Paths.get(file.getAbsolutePath()); 1955 copyFileTree(asPath, target.resolve(asPath.getFileName())); 1956 } 1957 } 1958 } 1892 1959 } -
trunk/src/org/expeditee/gui/FrameUtils.java
r1242 r1244 1090 1090 Logger.Log(e); 1091 1091 e.printStackTrace(); 1092 MessageBay.warningMessage("Exception occured when loading " + i.getClass().getSimpleName() + "(ID: " 1093 + i.getID() + ") " + e.getMessage() != null ? e.getMessage() : ""); 1092 System.err.println("**** Have temporarily supressed MessageBay call, as resulted in infinite recursion"); 1093 //MessageBay.warningMessage("Exception occured when loading " + i.getClass().getSimpleName() + "(ID: " 1094 // + i.getID() + ") " + e.getMessage() != null ? e.getMessage() : ""); 1094 1095 } 1095 1096 } … … 1820 1821 */ 1821 1822 public static void extractResources(boolean force) { 1822 // Extract private resources1823 Path resourcesPrivate = Paths.get(FrameIO.PARENT_FOLDER).resolve("resources-private");1824 extractResources("org/expeditee/assets/resources-private", resourcesPrivate, force);1825 1823 1826 // Extract public resources 1827 Path resourcesPublic = Paths.get(FrameIO.PARENT_FOLDER).resolve("resources-public"); 1828 extractResources("org/expeditee/assets/resources-public", resourcesPublic, force); 1824 if (UserSettings.PublicAndPrivateResources) { 1825 // Extract private resources 1826 Path resourcesPrivate = Paths.get(FrameIO.PARENT_FOLDER).resolve("resources-private"); 1827 extractResources("org/expeditee/assets/resources-private", resourcesPrivate, force); 1828 1829 // Extract public resources 1830 Path resourcesPublic = Paths.get(FrameIO.PARENT_FOLDER).resolve("resources-public"); 1831 extractResources("org/expeditee/assets/resources-public", resourcesPublic, force); 1832 } 1829 1833 } 1830 1834 -
trunk/src/org/expeditee/items/Item.java
r1212 r1244 2301 2301 int newWidth = i - getX() - Item.MARGIN_LEFT; 2302 2302 if (newWidth < 0) newWidth = 0; 2303 2303 2304 if (!fixWidth) { 2304 2305 newWidth *= -1; -
trunk/src/org/expeditee/items/Text.java
r1210 r1244 226 226 } 227 227 228 System.out.print("'" + font_family + "'"); 228 //System.out.print("'" + font_family + "'"); 229 229 230 } else { 230 231 System.err.println("Error: Failed to add custom True-Type Font file: " + fontFile); … … 2279 2280 Frame modelFrame = getParentOrCurrentFrame(); 2280 2281 if (modelFrame != null) { 2281 setRightMargin(modelFrame.getNameItem().getX() - MARGIN_LEFT, true); 2282 int model_frame_name_x = modelFrame.getNameItem().getX(); 2283 if (model_frame_name_x < DisplayController.MINIMUM_FRAME_WIDTH) { 2284 System.err.println("resetTitlePostion(): value to be used as right margin from position of frameName < 512"); 2285 System.err.println("Overriding to ensure reasonable width for title"); 2286 model_frame_name_x = DisplayController.MINIMUM_FRAME_WIDTH; 2287 } 2288 2289 setRightMargin(model_frame_name_x - MARGIN_LEFT, true); 2282 2290 } else { 2283 2291 System.out.print("Error: text.resetTitlePosition, getParent or currentFrame returned null"); -
trunk/src/org/expeditee/settings/Settings.java
r1242 r1244 241 241 continue; 242 242 } 243 System.out.println(" Generating " + name);243 System.out.println("@Settings: Generating " + name); 244 244 generateSettingsTree(k, frames.addText(name.substring(0, 1).toUpperCase() + name.substring(1), null, null, null, false)); 245 245 } -
trunk/src/org/expeditee/settings/UserSettings.java
r1242 r1244 27 27 import java.util.List; 28 28 29 import org.apollo.io.AudioPathManager; 29 30 import org.expeditee.agents.SearchGreenstone; 30 31 import org.expeditee.agents.mail.MailSession; … … 53 54 public static String DEFAULT_PROFILE_NAME = "default"; 54 55 55 public static Boolean multiUserMode;56 public static Boolean PublicAndPrivateResources; 56 57 57 58 public static final IntegerSetting Gravity = new IntegerSetting("Distance the cursor has to be from a text item to select the text item", "Gravity", 3); … … 70 71 } 71 72 String first = FrameUtils.getLink(text, UserSettings.HomeFrame.get()); 72 // do not use non-exist ant frames as the first frame73 // do not use non-existent frames as the first frame 73 74 if (FrameIO.isValidFrameName(first)) { 74 75 _value = first; … … 203 204 static { 204 205 // Are we in the new regime or the old regime? 205 File resFile = Paths.get(get DesiredExpediteeHome()).resolve(".res").toFile();206 File resourcesPrivateFile = Paths.get(get DesiredExpediteeHome() + "resources-private" + File.separator).toFile();206 File resFile = Paths.get(getExpediteeHome()).resolve(".res").toFile(); 207 File resourcesPrivateFile = Paths.get(getExpediteeHome() + "resources-private" + File.separator).toFile(); 207 208 if (resourcesPrivateFile.exists()) { 208 // If resources-private exists than this is a good sign we have new regime available. 209 multiUserMode = Boolean.TRUE; 210 } else if (resFile.exists()) { 209 // If resources-private exists then this is a good sign we have new regime available. 210 PublicAndPrivateResources = Boolean.TRUE; 211 } 212 else if (resFile.exists()) { 211 213 // If we do not, but do have the .res file then this is a good sign we are in old regime. 212 multiUserMode = Boolean.FALSE; 213 } else { 214 PublicAndPrivateResources = Boolean.FALSE; 215 } 216 else { 214 217 // If we have neither then we are unpacking and therefore will have new regime available once unpacked. 215 multiUserMode= Boolean.TRUE;218 PublicAndPrivateResources = Boolean.TRUE; 216 219 } 217 220 … … 219 222 } 220 223 221 public static void setupDefaultFolders() { 222 FrameIO.changeParentFolder(getDesiredExpediteeHome()); 223 224 public static void setupDefaultFolders() { 225 String expeditee_home = getExpediteeHome(); 226 227 FrameIO.changeParentAndSubFolders(expeditee_home); 228 224 229 FolderSettings.FrameDirs.get().clear(); 225 230 FolderSettings.ImageDirs.get().clear(); 231 FolderSettings.AudioDirs.get().clear(); 226 232 appendDefaultFolders(); 227 } 228 229 private static String getDesiredExpediteeHome() { 230 String homeProperty = System.getProperty("expeditee.home"); 231 String expeditee_home = homeProperty == null ? getSaveLocation() : homeProperty + File.separator; 233 234 } 235 236 private static String getExpediteeHome() { 237 String home_property = System.getProperty("expeditee.home"); 238 String expeditee_home = (home_property != null) ? home_property + File.separator : getSaveLocation(); 232 239 return expeditee_home; 233 240 } 234 241 235 242 public static void appendDefaultFolders() { 236 if ( multiUserMode) {243 if (PublicAndPrivateResources) { 237 244 // The comments here explain how things have changed with the new regime. 238 245 // FrameDirs … … 244 251 // 6. MESSAGES_PATH Still points to same place. Should these be per user and encrypted? 245 252 // 7. PUBLIC_PATH Still points to same place. Kept for compatibility. 246 FolderSettings.FrameDirs. get().add(FrameIO.PROFILE_PATH);247 FolderSettings.FrameDirs. get().add(FrameIO.FRAME_PRIVATE_PATH);248 FolderSettings.FrameDirs. get().add(FrameIO.SHARED_FRAMESETS_PATH);249 FolderSettings.FrameDirs. get().add(FrameIO.FRAME_PATH);250 FolderSettings.FrameDirs. get().add(FrameIO.RESOURCES_PATH);251 FolderSettings.FrameDirs. get().add(FrameIO.MESSAGES_PATH);252 FolderSettings.FrameDirs. get().add(FrameIO.PUBLIC_PATH);253 FolderSettings.FrameDirs.addAbsoluteDir(FrameIO.PROFILE_PATH); 254 FolderSettings.FrameDirs.addAbsoluteDir(FrameIO.FRAME_PRIVATE_PATH); 255 FolderSettings.FrameDirs.addAbsoluteDir(FrameIO.SHARED_FRAMESETS_PATH); 256 FolderSettings.FrameDirs.addAbsoluteDir(FrameIO.FRAME_PATH); 257 FolderSettings.FrameDirs.addAbsoluteDir(FrameIO.RESOURCES_PATH); 258 FolderSettings.FrameDirs.addAbsoluteDir(FrameIO.MESSAGES_PATH); 259 FolderSettings.FrameDirs.addAbsoluteDir(FrameIO.PUBLIC_PATH); 253 260 FolderSettings.FrameDirs.setDefault(FolderSettings.FrameDirs.get()); 254 261 … … 259 266 FolderSettings.ImageDirs.get().add(FrameIO.IMAGES_PATH); 260 267 FolderSettings.ImageDirs.setDefault(FolderSettings.ImageDirs.get()); 268 269 FolderSettings.AudioDirs.get().add(FrameIO.AUDIO_PRIVATE_PATH); 270 FolderSettings.AudioDirs.get().add(FrameIO.AUDIO_PATH); 271 FolderSettings.AudioDirs.setDefault(FolderSettings.AudioDirs.get()); 272 261 273 } else { 262 FolderSettings.FrameDirs. get().add(FrameIO.FRAME_PATH);263 FolderSettings.FrameDirs. get().add(FrameIO.PUBLIC_PATH);264 FolderSettings.FrameDirs. get().add(FrameIO.PROFILE_PATH);265 FolderSettings.FrameDirs. get().add(FrameIO.HELP_PATH);266 FolderSettings.FrameDirs. get().add(FrameIO.MESSAGES_PATH);274 FolderSettings.FrameDirs.addAbsoluteDir(FrameIO.FRAME_PATH); 275 FolderSettings.FrameDirs.addAbsoluteDir(FrameIO.PUBLIC_PATH); 276 FolderSettings.FrameDirs.addAbsoluteDir(FrameIO.PROFILE_PATH); 277 FolderSettings.FrameDirs.addAbsoluteDir(FrameIO.HELP_PATH); 278 FolderSettings.FrameDirs.addAbsoluteDir(FrameIO.MESSAGES_PATH); 267 279 FolderSettings.FrameDirs.setDefault(FolderSettings.FrameDirs.get()); 280 268 281 FolderSettings.ImageDirs.get().add(FrameIO.IMAGES_PATH); 269 282 FolderSettings.ImageDirs.setDefault(FolderSettings.ImageDirs.get()); 283 284 FolderSettings.AudioDirs.get().add(FrameIO.AUDIO_PATH); 285 FolderSettings.AudioDirs.setDefault(FolderSettings.AudioDirs.get()); 270 286 } 271 287 } -
trunk/src/org/expeditee/settings/folders/FolderSettings.java
r1242 r1244 19 19 package org.expeditee.settings.folders; 20 20 21 import java.io.File; 22 import java.util.ArrayList; 23 import java.util.List; 24 21 25 import org.expeditee.gui.AttributeValuePair; 22 26 import org.expeditee.gui.FrameIO; 23 27 import org.expeditee.gui.FrameUtils; 24 28 import org.expeditee.items.Text; 29 import org.expeditee.setting.DirectoryListSetting; 25 30 import org.expeditee.setting.ListSetting; 26 31 import org.expeditee.setting.Setting; … … 28 33 public class FolderSettings { 29 34 30 public static final ListSetting<String> FrameDirs = new ListSetting<String>("Directories to look in for frames", "FrameDirs") { 31 @Override 32 public boolean setSetting(Text text) { 33 _value.addAll(FrameUtils.getDirs(text)); 34 return true; 35 } 36 }; 35 public static final DirectoryListSetting FrameDirs = new DirectoryListSetting("Directories to look in for frames", "FrameDirs"); 36 37 37 public static final Setting FramesetDir = new Setting("Adds a directory to look in for frames", "FramesetDir") { 38 38 @Override … … 90 90 }; 91 91 92 93 public static ListSetting<String> AudioDirs = new ListSetting<String>("Directories to look in for audio", "AudioDirs") { 94 @Override 95 public boolean setSetting(Text text) { 96 _value.addAll(FrameUtils.getDirs(text)); 97 return true; 98 } 99 }; 100 public static final Setting AudioDir = new Setting("Adds a directory to look in for audio", "AudioDir") { 101 @Override 102 public boolean setSetting(Text text) { 103 if(text.getText().indexOf(':') == -1) { 104 return false; 105 } 106 AttributeValuePair avp = new AttributeValuePair(text.getText()); 107 if(avp.getValue().trim().length() != 0) { 108 String dir = FrameUtils.getDir(avp.getValue()); 109 if(dir != null) { 110 FolderSettings.AudioDirs.get().add(0, dir); 111 return true; 112 } 113 } 114 return false; 115 } 116 117 @Override 118 public Text generateRepresentation(String label, String frameset) { 119 Text t = new Text(label); 120 return t; 121 } 122 }; 123 124 92 125 public static final Setting LogDir = new Setting("Set the directory to save logs", "LogDir") { 93 126 @Override -
trunk/src/org/expeditee/settings/templates/TemplateSettings.java
r1242 r1244 138 138 Text t = new Text("TitleTemplate"); 139 139 t.setSize(30); 140 t.setWidth(895); 140 141 t.setFontStyle("Bold"); 141 142 t.setFamily("SansSerif"); -
trunk/src/org/expeditee/stats/DocumentStatsFast.java
r919 r1244 75 75 76 76 String fullPath = null; 77 for (String possiblePath : FolderSettings.FrameDirs.get ()) {77 for (String possiblePath : FolderSettings.FrameDirs.getAbsoluteDirs()) { 78 78 fullPath = FrameIO.getFrameFullPathName(possiblePath, _name); 79 79 if (fullPath != null) -
trunk/src/org/expeditee/stats/StatsLogger.java
r919 r1244 61 61 62 62 _filename = Formatter.getDateTime() + ".stat"; 63 _filename = _filename.replace(":","_"); 63 64 } 64 65
Note:
See TracChangeset
for help on using the changeset viewer.