Changeset 1232 for trunk


Ignore:
Timestamp:
02/04/19 13:54:46 (5 years ago)
Author:
bln4
Message:

Amendment to previous commit.

org.expeditee.gui.Frame ->
org.expeditee.gui.FrameIO ->

When loading a frame and deciding if the cache should be used, the file system is now consulted to check if there is a more recent version available. If there is then the cache is not used. This is useful for collaborative frame authoring when access to frame is controlled via a system such as google drive.


New stuffs.
org.expeditee.gui.FrameIO ->
org.expeditee.io.DefaultFrameReader ->
org.expeditee.io.ExpReader ->

When saving a frame, if there is a newer version (than what is cached) on the file system, then treat that a version collision (creates a new frame with your edits on it so that it can be manually resolved)

Location:
trunk/src/org/expeditee
Files:
3 edited

Legend:

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

    r1229 r1232  
    961961        public static String SaveFrame(Frame toSave, boolean inc,
    962962                        boolean checkBackup) {
    963                
    964                 if (toSave.getName().startsWith("ExpediteeMail")) {
    965                         System.err.println();
    966                 }
    967963
    968964                // TODO When loading a frame maybe append onto the event history too-
    969                 // with a
    970                 // break to indicate the end of a session
     965                // with a break to indicate the end of a session
    971966
    972967                if (toSave == null || !toSave.hasChanged() || toSave.isSaved()) {
     
    10311026                                savedVersion = KMSReader.getVersion(fullPath);
    10321027                        }
    1033 
     1028                       
    10341029                        // Check if the frame doesnt exist
    10351030                        // if (savedVersion < 0) {
     
    10471042                        // Check if we are trying to save an out of date version
    10481043                        String framesetName = toSave.getFramesetName();
     1044                        long frameLastModify = toSave.getLastModifyPrecise();
     1045                        long fileLastModify = new File(fullPath).lastModified();
     1046                        boolean versionConflict = frameLastModify < fileLastModify;
    10491047                        boolean isBayFrameset =
    10501048                                        framesetName.equalsIgnoreCase(MessageBay.MESSAGES_FRAMESET_NAME) ||
    10511049                                        framesetName.equalsIgnoreCase(MailBay.EXPEDITEE_MAIL_FRAMESET_NAME);
    1052                         if (savedVersion > toSave.getVersion() && !isBayFrameset) {
     1050                        if ((savedVersion > toSave.getVersion() || versionConflict) && !isBayFrameset) {
    10531051                                // remove this frame from the cache if it is there
    10541052                                // This will make sure links to the original are set correctly
  • trunk/src/org/expeditee/io/DefaultFrameReader.java

    r1226 r1232  
    2020
    2121import java.io.BufferedReader;
     22import java.io.File;
    2223import java.io.FileInputStream;
    2324import java.io.IOException;
     
    178179       
    179180        public Frame readFrame(String fullPath) throws IOException {
     181                File f = new File(fullPath);
    180182                Reader in = new InputStreamReader(new FileInputStream(fullPath), "UTF-8");
    181                 return readFrame(new BufferedReader(in));
     183                Frame frame = readFrame(new BufferedReader(in));
     184                frame.setLastModifyDate(frame.getLastModifyDate(), f.lastModified());
     185                return frame;
    182186        }
    183187}
  • trunk/src/org/expeditee/io/ExpReader.java

    r1207 r1232  
    9090                String next = "";
    9191                Frame newFrame = new Frame();
    92 
     92               
    9393                try {
    9494                        // Framename must be set before setting the frame number
Note: See TracChangeset for help on using the changeset viewer.