Changeset 86 for trunk/src/org/expeditee/gui/FrameIO.java
- Timestamp:
- 06/05/08 10:11:18 (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/expeditee/gui/FrameIO.java
r80 r86 54 54 */ 55 55 public static String IMAGES_FOLDER = "images" + File.separator; 56 56 57 57 public static String TRASH_PATH; 58 58 … … 79 79 public static final int MAX_NAME_LENGTH = 64; 80 80 81 public static final int MAX_CACHE = 2000;81 public static final int MAX_CACHE = 100; 82 82 83 83 private static HashMap<String, Frame> _Cache = new HashMap<String, Frame>(); … … 286 286 287 287 _UseCache = false; 288 Frame fresh = FrameIO.LoadFrame(DisplayIO.getCurrentFrame() 289 .getName()); 288 Frame fresh = FrameIO.LoadFrame(DisplayIO.getCurrentFrame().getName()); 290 289 _UseCache = cache; 291 290 if (_Cache.containsKey(fresh.getName().toLowerCase())) … … 310 309 // if we did not find another Frame then this one must be the last one 311 310 // in the frameset 312 FrameGraphics.DisplayMessage("This is the first frame in the frameset"); 311 FrameGraphics 312 .DisplayMessageOnce("This is the first frame in the frameset"); 313 313 return null; 314 314 } … … 347 347 // if we did not find another Frame then this one must be the last one 348 348 // in the frameset 349 FrameGraphics.DisplayMessage("This is the last frame in the frameset"); 349 FrameGraphics 350 .DisplayMessageOnce("This is the last frame in the frameset"); 350 351 return null; 351 352 } … … 359 360 * @param current 360 361 */ 361 p rivatestatic void checkTDFC(Frame current) {362 public static void checkTDFC(Frame current) { 362 363 if (FrameUtils.getTdfcItem() != null) { 363 364 FrameUtils.setTdfcItem(null); … … 447 448 448 449 // get the fill path to determine which file version it is 449 String source = getFrameFullPathName(toDelete.path, toDelete 450 .getName()); 450 String source = getFrameFullPathName(toDelete.path, toDelete.getName()); 451 451 452 452 String oldFrameName = toDelete.getName().toLowerCase(); … … 484 484 485 485 if (!FrameIO.isValidFramesetName(frameset)) { 486 throw new RuntimeException(frameset + " is not a valid frameset name"); 487 } 488 486 throw new RuntimeException(frameset 487 + " is not a valid frameset name"); 488 } 489 489 490 int next = -1; 490 491 … … 519 520 } 520 521 522 // Remove the old frame from the cashe then add the new one 523 // TODO figure out some way that we can put both in the cache 524 _Cache.remove(template.getName().toLowerCase()); 521 525 // set the number and title of the new frame 522 template.setName(frameset, ++ 526 template.setName(frameset, ++next); 523 527 template.setTitle(frameTitle); 528 // _Cache.put(template.getName().toLowerCase(), template); 524 529 525 530 Logger.Log(Logger.SYSTEM, Logger.TDFC, "Creating new frame: " … … 655 660 if (!toSave.hasChanged() || toSave.isSaved()) 656 661 return ""; 657 658 //Dont save if the frame is protected659 if (toSave.getNameItem().Permission < Item.PERMISSION_TDFC)660 return "";661 662 662 663 // Get the full path only to determine which format to use for saving … … 665 666 // Later this will be changed so that KMS frames will be updated to the 666 667 // Exp format. 667 String fullPath = getFrameFullPathName(toSave.path, toSave 668 .getName()); 668 String fullPath = getFrameFullPathName(toSave.path, toSave.getName()); 669 670 // Dont save if the frame is protected and it exists 671 if (checkBackup 672 && toSave.getNameItem().Permission < Item.PERMISSION_TDFC) { 673 _Cache.remove(toSave.getName().toLowerCase()); 674 return ""; 675 } 669 676 670 677 // Check if the frame exists … … 723 730 int nextnum = ReadINF(toSave.path, toSave.getFramesetName()) + 1; 724 731 725 // Give it a negative framenumber so that when it is saved the726 // backup tag will be ignored727 732 original.setFrameNumber(nextnum); 728 733 original.setProtection("" + Item.PERMISSION_COPY); … … 748 753 _Cache.put(toSave.getName().toLowerCase(), toSave); 749 754 750 Logger.Log(Logger.SYSTEM, Logger.SAVE, "Saving " 751 + toSave.getName() +" to disk.");755 Logger.Log(Logger.SYSTEM, Logger.SAVE, "Saving " + toSave.getName() 756 + " to disk."); 752 757 753 758 // check that the INF file is not out of date … … 1123 1128 /** 1124 1129 * Copies a file from one location to another. 1130 * 1125 1131 * @param existingFile 1126 1132 * @param newFileName … … 1154 1160 1155 1161 public static boolean isValidLink(String frameName) { 1156 return frameName == null || isPositiveInteger(frameName) || isValidFrameName(frameName); 1162 return frameName == null || isPositiveInteger(frameName) 1163 || isValidFrameName(frameName); 1157 1164 } 1158 1165
Note:
See TracChangeset
for help on using the changeset viewer.