Ignore:
Timestamp:
05/10/18 16:04:51 (6 years ago)
Author:
davidb
Message:

Reworking of the code-base to separate logic from graphics. This version of Expeditee now supports a JFX graphics as an alternative to SWING

File:
1 edited

Legend:

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

    r997 r1102  
    195195        }
    196196
    197         public static Frame LoadFrame(String frameName, String path,
    198                         boolean ignoreAnnotations) {
    199                 if (!isValidFrameName(frameName))
    200                         return null;
     197        public static Frame LoadFrame(String frameName, String path, boolean ignoreAnnotations)
     198        {
     199                if (!isValidFrameName(frameName)) return null;
    201200
    202201                String frameNameLower = frameName.toLowerCase();
    203202                // first try reading from cache
    204203                if (isCacheOn() && _Cache.containsKey(frameNameLower)) {
    205                         Logger.Log(Logger.SYSTEM, Logger.LOAD, "Loading " + frameName
    206                                         + " from cache.");
     204                        Logger.Log(Logger.SYSTEM, Logger.LOAD, "Loading " + frameName + " from cache.");
    207205                        Frame frame = _Cache.get(frameNameLower);
    208206                        return frame;
     
    389387
    390388        public static boolean canAccessFrame(String frameName) {
    391                 Frame current = DisplayIO.getCurrentFrame();
     389                Frame current = DisplayController.getCurrentFrame();
    392390                // Just in case the current frame is not yet saved...
    393391                if (frameName.equals(current.getName())) {
     
    490488
    491489                _UseCache = false;
    492                 Frame fresh = FrameIO.LoadFrame(DisplayIO.getCurrentFrame().getName());
     490                Frame fresh = FrameIO.LoadFrame(DisplayController.getCurrentFrame().getName());
    493491                _UseCache = cache;
    494492                if (_Cache.containsKey(fresh.getName().toLowerCase()))
    495493                        addToCache(fresh);
    496                 DisplayIO.setCurrentFrame(fresh, false);
     494                DisplayController.setCurrentFrame(fresh, false);
    497495        }
    498496
     
    599597
    600598        public static Frame LoadZero() {
    601                 Frame current = DisplayIO.getCurrentFrame();
     599                Frame current = DisplayController.getCurrentFrame();
    602600                return LoadZero(current.getFramesetName(), current.getPath());
    603601        }
    604602
    605603        public static Frame LoadLast() {
    606                 Frame current = DisplayIO.getCurrentFrame();
     604                Frame current = DisplayController.getCurrentFrame();
    607605                return LoadLast(current.getFramesetName(), current.getPath());
    608606        }
    609607
    610608        public static Frame LoadNext() {
    611                 return LoadNext(DisplayIO.getCurrentFrame());
     609                return LoadNext(DisplayController.getCurrentFrame());
    612610        }
    613611
    614612        public static Frame LoadPrevious() {
    615                 return LoadPrevious(DisplayIO.getCurrentFrame());
     613                return LoadPrevious(DisplayController.getCurrentFrame());
    616614        }
    617615
     
    747745                }
    748746
    749                 // Remove the old frame from the cashe then add the new one
     747                // Remove the old frame from the cache then add the new one
    750748                // TODO figure out some way that we can put both in the cache
    751749                _Cache.remove(template.getName().toLowerCase());
     
    770768                Item titleItem = template.getTitleItem();
    771769
    772                 if (!DisplayIO.isTwinFramesOn() && !Justification.center.equals(((Text)titleItem).getJustification())) {
     770                if (!DisplayController.isTwinFramesOn() && !Justification.center.equals(((Text)titleItem).getJustification())) {
    773771                        if ((titleItem.getX() + 1) < template.getNameItem().getX()) {
    774772                                while (titleItem.getSize() > Text.MINIMUM_FONT_SIZE
     
    811809        }
    812810
    813         public static void RefreshCasheImages() {
     811        public static void RefreshCacheImages()
     812        {
    814813                SuspendCache();
    815                 for (Frame f : _Cache.values())
    816                         f.setBuffer(null);
     814                for (Frame frame : _Cache.values()) frame.setBuffer(null);
    817815                ResumeCache();
    818816        }
     
    11521150         * @return true if the frame is in the current user profile frameset
    11531151         */
    1154         public static boolean isProfileFrame(Frame toCheck) {
    1155                 if (toCheck.getNumber() == 0)
    1156                         return false;
     1152        public static boolean isProfileFrame(Frame toCheck)
     1153        {
     1154                if (toCheck.getNumber() == 0) return false;
     1155               
    11571156                return toCheck.getPath().equals(PROFILE_PATH);
    11581157                // return toCheck.getFramesetName()
     
    11601159        }
    11611160
    1162         public static Frame LoadProfile(String userName) {
     1161        public static Frame LoadProfile(String userName)
     1162        {
    11631163                return LoadFrame(userName + "1");
    11641164        }
     
    12991299                String templateLink = linker.getAbsoluteLinkTemplate();
    13001300                String framesetLink = linker.getAbsoluteLinkFrameset();
    1301                 String frameset = (framesetLink != null ? framesetLink : DisplayIO
     1301                String frameset = (framesetLink != null ? framesetLink : DisplayController
    13021302                                .getCurrentFrame().getFramesetName());
    13031303
     
    13221322         */
    13231323        public static Frame CreateNewFrameset(String name) throws Exception {
    1324                 String path = DisplayIO.getCurrentFrame().getPath();
     1324                String path = DisplayController.getCurrentFrame().getPath();
    13251325
    13261326                // if current frameset is profile directory change it to framesets
     
    13941394        }
    13951395
    1396         public static Frame CreateFrameset(String frameset, String path,
    1397                         boolean recreate) throws Exception {
     1396        public static Frame CreateFrameset(String frameset, String path, boolean recreate) throws Exception
     1397        {
    13981398                String conversion = frameset + " --> ";
    13991399
    1400                 if (!isValidFramesetName(frameset)) {
    1401                         throw new Exception("Invalid frameset name");
    1402                 }
     1400                if (!isValidFramesetName(frameset)) throw new Exception("Invalid frameset name");
    14031401
    14041402                if (!recreate && FrameIO.canAccessFrameset(frameset)) {
     
    14741472                SaveFrame(base, true);
    14751473
    1476                 Logger.Log(Logger.SYSTEM, Logger.NEW_FRAMESET, "Created new frameset: "
    1477                                 + frameset);
     1474                Logger.Log(Logger.SYSTEM, Logger.NEW_FRAMESET, "Created new frameset: " + frameset);
    14781475
    14791476                return base;
Note: See TracChangeset for help on using the changeset viewer.