Ignore:
Timestamp:
06/05/08 10:11:18 (16 years ago)
Author:
ra33
Message:

Added DebugFrame action
Added GetCometStats
Lots of bug fixes

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/expeditee/gui/FrameIO.java

    r80 r86  
    5454         */
    5555        public static String IMAGES_FOLDER = "images" + File.separator;
    56        
     56
    5757        public static String TRASH_PATH;
    5858
     
    7979        public static final int MAX_NAME_LENGTH = 64;
    8080
    81         public static final int MAX_CACHE = 2000;
     81        public static final int MAX_CACHE = 100;
    8282
    8383        private static HashMap<String, Frame> _Cache = new HashMap<String, Frame>();
     
    286286
    287287                _UseCache = false;
    288                 Frame fresh = FrameIO.LoadFrame(DisplayIO.getCurrentFrame()
    289                                 .getName());
     288                Frame fresh = FrameIO.LoadFrame(DisplayIO.getCurrentFrame().getName());
    290289                _UseCache = cache;
    291290                if (_Cache.containsKey(fresh.getName().toLowerCase()))
     
    310309                // if we did not find another Frame then this one must be the last one
    311310                // 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");
    313313                return null;
    314314        }
     
    347347                // if we did not find another Frame then this one must be the last one
    348348                // 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");
    350351                return null;
    351352        }
     
    359360         * @param current
    360361         */
    361         private static void checkTDFC(Frame current) {
     362        public static void checkTDFC(Frame current) {
    362363                if (FrameUtils.getTdfcItem() != null) {
    363364                        FrameUtils.setTdfcItem(null);
     
    447448
    448449                // 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());
    451451
    452452                String oldFrameName = toDelete.getName().toLowerCase();
     
    484484
    485485                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
    489490                int next = -1;
    490491
     
    519520                }
    520521
     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());
    521525                // set the number and title of the new frame
    522                 template.setName(frameset, ++ next);
     526                template.setName(frameset, ++next);
    523527                template.setTitle(frameTitle);
     528                // _Cache.put(template.getName().toLowerCase(), template);
    524529
    525530                Logger.Log(Logger.SYSTEM, Logger.TDFC, "Creating new frame: "
     
    655660                if (!toSave.hasChanged() || toSave.isSaved())
    656661                        return "";
    657                
    658                 //Dont save if the frame is protected
    659                 if (toSave.getNameItem().Permission < Item.PERMISSION_TDFC)
    660                         return "";
    661662
    662663                // Get the full path only to determine which format to use for saving
     
    665666                // Later this will be changed so that KMS frames will be updated to the
    666667                // 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                }
    669676
    670677                // Check if the frame exists
     
    723730                                int nextnum = ReadINF(toSave.path, toSave.getFramesetName()) + 1;
    724731
    725                                 // Give it a negative framenumber so that when it is saved the
    726                                 // backup tag will be ignored
    727732                                original.setFrameNumber(nextnum);
    728733                                original.setProtection("" + Item.PERMISSION_COPY);
     
    748753                                _Cache.put(toSave.getName().toLowerCase(), toSave);
    749754
    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.");
    752757
    753758                        // check that the INF file is not out of date
     
    11231128        /**
    11241129         * Copies a file from one location to another.
     1130         *
    11251131         * @param existingFile
    11261132         * @param newFileName
     
    11541160
    11551161        public static boolean isValidLink(String frameName) {
    1156                 return frameName == null || isPositiveInteger(frameName) || isValidFrameName(frameName);
     1162                return frameName == null || isPositiveInteger(frameName)
     1163                                || isValidFrameName(frameName);
    11571164        }
    11581165
Note: See TracChangeset for help on using the changeset viewer.