Changeset 162 for trunk/src/org/expeditee/gui/FrameIO.java
- Timestamp:
- 07/28/08 15:08:13 (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/expeditee/gui/FrameIO.java
r156 r162 5 5 import java.io.File; 6 6 import java.io.FileInputStream; 7 import java.io.FileNotFoundException; 7 8 import java.io.FileOutputStream; 8 9 import java.io.FileReader; … … 10 11 import java.io.IOException; 11 12 import java.sql.Time; 13 import java.util.Collection; 12 14 import java.util.HashMap; 15 import java.util.LinkedList; 13 16 14 17 import org.expeditee.agents.ExistingFramesetException; … … 239 242 } 240 243 244 public static Collection<String> searchFrame(String frameName, 245 String pattern, String path) { 246 String fullPath = null; 247 if (path == null) { 248 for (String possiblePath : UserSettings.FrameDirs) { 249 fullPath = getFrameFullPathName(possiblePath, frameName); 250 if (fullPath != null) 251 break; 252 } 253 } else { 254 fullPath = getFrameFullPathName(path, frameName); 255 assert(fullPath != null); 256 } 257 // If the frame was not located return null 258 if (fullPath == null) 259 return null; 260 Collection<String> results = new LinkedList<String>(); 261 // Open the file and search the text items 262 try { 263 BufferedReader reader = new BufferedReader(new FileReader(fullPath)); 264 String next; 265 while (reader.ready() && ((next = reader.readLine()) != null)) { 266 if (next.startsWith("T")) { 267 String toSearch = next.substring(2); 268 if (toSearch.toLowerCase().matches(pattern)) 269 results.add(toSearch); 270 } 271 } 272 } catch (FileNotFoundException e) { 273 e.printStackTrace(); 274 return null; 275 } catch (IOException e) { 276 e.printStackTrace(); 277 } 278 return results; 279 } 280 241 281 private static Frame LoadFrame(String path, String frameName) { 242 282 String fullPath = getFrameFullPathName(path, frameName); … … 349 389 // if we did not find another Frame then this one must be the last one 350 390 // in the frameset 351 MessageBay 352 .displayMessageOnce("This is the last frame in the frameset"); 391 MessageBay.displayMessageOnce("This is the last frame in the frameset"); 353 392 return null; 354 393 } … … 421 460 * @param toDelete 422 461 * The Frame to be deleted 423 * @return The name the deleted frame was changed to, or null if the delete failed 462 * @return The name the deleted frame was changed to, or null if the delete 463 * failed 424 464 */ 425 465 public static String DeleteFrame(Frame toDelete) throws IOException, … … 468 508 ff.close(); 469 509 470 if ( del.delete()){510 if (del.delete()) { 471 511 return toDelete.getName(); 472 512 } 473 513 474 514 return null; 475 515 } … … 552 592 i.setLink(null); 553 593 } 554 594 555 595 // do auto shrinking of the title IF not in twin frames mode 556 596 Item titleItem = template.getTitleItem(); … … 676 716 boolean checkBackup) { 677 717 678 // TODO When loading a frame maybe append onto the event history too- with a 718 // TODO When loading a frame maybe append onto the event history too- 719 // with a 679 720 // break to indicate the end of a session 680 721 681 if (toSave == null || !toSave.hasChanged() || toSave.isSaved()){722 if (toSave == null || !toSave.hasChanged() || toSave.isSaved()) { 682 723 SessionStats.NewFrameSession(); 683 724 return ""; … … 691 732 692 733 // Dont save if the frame is protected and it exists 693 if (checkBackup 694 && toSave.isReadOnly()) { 734 if (checkBackup && toSave.isReadOnly()) { 695 735 _Cache.remove(toSave.getName().toLowerCase()); 696 736 SessionStats.NewFrameSession(); … … 776 816 toSave.setActiveTime(activeTime); 777 817 778 // int oldMode = FrameGraphics.getMode();779 // if (oldMode != FrameGraphics.MODE_XRAY)780 // 818 // int oldMode = FrameGraphics.getMode(); 819 // if (oldMode != FrameGraphics.MODE_XRAY) 820 // FrameGraphics.setMode(FrameGraphics.MODE_XRAY, true); 781 821 writer.writeFrame(toSave); 782 // FrameGraphics.setMode(oldMode, true);822 // FrameGraphics.setMode(oldMode, true); 783 823 toSave.setSaved(); 784 824 if (inc) {
Note:
See TracChangeset
for help on using the changeset viewer.