Changeset 1102 for trunk/src/org/expeditee/gui/FrameIO.java
- Timestamp:
- 05/10/18 16:04:51 (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/expeditee/gui/FrameIO.java
r997 r1102 195 195 } 196 196 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; 201 200 202 201 String frameNameLower = frameName.toLowerCase(); 203 202 // first try reading from cache 204 203 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."); 207 205 Frame frame = _Cache.get(frameNameLower); 208 206 return frame; … … 389 387 390 388 public static boolean canAccessFrame(String frameName) { 391 Frame current = Display IO.getCurrentFrame();389 Frame current = DisplayController.getCurrentFrame(); 392 390 // Just in case the current frame is not yet saved... 393 391 if (frameName.equals(current.getName())) { … … 490 488 491 489 _UseCache = false; 492 Frame fresh = FrameIO.LoadFrame(Display IO.getCurrentFrame().getName());490 Frame fresh = FrameIO.LoadFrame(DisplayController.getCurrentFrame().getName()); 493 491 _UseCache = cache; 494 492 if (_Cache.containsKey(fresh.getName().toLowerCase())) 495 493 addToCache(fresh); 496 Display IO.setCurrentFrame(fresh, false);494 DisplayController.setCurrentFrame(fresh, false); 497 495 } 498 496 … … 599 597 600 598 public static Frame LoadZero() { 601 Frame current = Display IO.getCurrentFrame();599 Frame current = DisplayController.getCurrentFrame(); 602 600 return LoadZero(current.getFramesetName(), current.getPath()); 603 601 } 604 602 605 603 public static Frame LoadLast() { 606 Frame current = Display IO.getCurrentFrame();604 Frame current = DisplayController.getCurrentFrame(); 607 605 return LoadLast(current.getFramesetName(), current.getPath()); 608 606 } 609 607 610 608 public static Frame LoadNext() { 611 return LoadNext(Display IO.getCurrentFrame());609 return LoadNext(DisplayController.getCurrentFrame()); 612 610 } 613 611 614 612 public static Frame LoadPrevious() { 615 return LoadPrevious(Display IO.getCurrentFrame());613 return LoadPrevious(DisplayController.getCurrentFrame()); 616 614 } 617 615 … … 747 745 } 748 746 749 // Remove the old frame from the ca she then add the new one747 // Remove the old frame from the cache then add the new one 750 748 // TODO figure out some way that we can put both in the cache 751 749 _Cache.remove(template.getName().toLowerCase()); … … 770 768 Item titleItem = template.getTitleItem(); 771 769 772 if (!Display IO.isTwinFramesOn() && !Justification.center.equals(((Text)titleItem).getJustification())) {770 if (!DisplayController.isTwinFramesOn() && !Justification.center.equals(((Text)titleItem).getJustification())) { 773 771 if ((titleItem.getX() + 1) < template.getNameItem().getX()) { 774 772 while (titleItem.getSize() > Text.MINIMUM_FONT_SIZE … … 811 809 } 812 810 813 public static void RefreshCasheImages() { 811 public static void RefreshCacheImages() 812 { 814 813 SuspendCache(); 815 for (Frame f : _Cache.values()) 816 f.setBuffer(null); 814 for (Frame frame : _Cache.values()) frame.setBuffer(null); 817 815 ResumeCache(); 818 816 } … … 1152 1150 * @return true if the frame is in the current user profile frameset 1153 1151 */ 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 1157 1156 return toCheck.getPath().equals(PROFILE_PATH); 1158 1157 // return toCheck.getFramesetName() … … 1160 1159 } 1161 1160 1162 public static Frame LoadProfile(String userName) { 1161 public static Frame LoadProfile(String userName) 1162 { 1163 1163 return LoadFrame(userName + "1"); 1164 1164 } … … 1299 1299 String templateLink = linker.getAbsoluteLinkTemplate(); 1300 1300 String framesetLink = linker.getAbsoluteLinkFrameset(); 1301 String frameset = (framesetLink != null ? framesetLink : Display IO1301 String frameset = (framesetLink != null ? framesetLink : DisplayController 1302 1302 .getCurrentFrame().getFramesetName()); 1303 1303 … … 1322 1322 */ 1323 1323 public static Frame CreateNewFrameset(String name) throws Exception { 1324 String path = Display IO.getCurrentFrame().getPath();1324 String path = DisplayController.getCurrentFrame().getPath(); 1325 1325 1326 1326 // if current frameset is profile directory change it to framesets … … 1394 1394 } 1395 1395 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 { 1398 1398 String conversion = frameset + " --> "; 1399 1399 1400 if (!isValidFramesetName(frameset)) { 1401 throw new Exception("Invalid frameset name"); 1402 } 1400 if (!isValidFramesetName(frameset)) throw new Exception("Invalid frameset name"); 1403 1401 1404 1402 if (!recreate && FrameIO.canAccessFrameset(frameset)) { … … 1474 1472 SaveFrame(base, true); 1475 1473 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); 1478 1475 1479 1476 return base;
Note:
See TracChangeset
for help on using the changeset viewer.