Changeset 103


Ignore:
Timestamp:
06/13/08 18:00:25 (16 years ago)
Author:
ra33
Message:

Fixed up a few bugs with Saving of frames when actions are performed and with Comet and Tree stats.

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

Legend:

Unmodified
Added
Removed
  • trunk/src/org/expeditee/actions/Actions.java

    r102 r103  
    7474                // Must be a forward slash for loading resources
    7575                String path = pckgname.replace('.', '/');
    76                 //System.out.println("Get classes: " + path);
     76                // System.out.println("Get classes: " + path);
    7777                try {
    7878                        ClassLoader cld = Thread.currentThread().getContextClassLoader();
     
    105105                                        + ") does not appear to be a valid package");
    106106                }
    107                 //System.out.println("Path:" + directory.getPath());
     107                // System.out.println("Path:" + directory.getPath());
    108108                int splitPoint = directory.getPath().indexOf('!');
    109109                if (splitPoint > 0) {
     
    118118                                        jarName = jarName.replace("%20", " ");
    119119                                }
    120                                 //System.out.println("JarName:" + jarName);
     120                                // System.out.println("JarName:" + jarName);
    121121                                JarFile jarFile = new JarFile(jarName);
    122122
     
    138138                                }
    139139                                jarFile.close();
    140                                 //System.out.println("Loaded " + classCount + " classes from "
    141                                 //              + pckgname);
     140                                // System.out.println("Loaded " + classCount + " classes from "
     141                                // + pckgname);
    142142
    143143                        } catch (Exception e) {
     
    291291         */
    292292        public static void PerformAction(Frame source, Item launcher, String command) {
    293                 if (!command.equalsIgnoreCase("Restore"))
    294                         FrameIO.SaveFrame(source, false);
     293                // if (!command.equalsIgnoreCase("Restore"))
     294                // FrameIO.SaveFrame(source, false);
     295                // TODO make restore UNDO the changes made by the last action
    295296
    296297                // separate method name and parameter names
     
    381382                name = name.toLowerCase();
    382383                // save the current frame (if necesssary)
    383                 FrameUtils.LeavingFrame(source);
     384                // TODO make this nicer... ie. make Format an action rather than an
     385                // agent and save frames only before running agents
     386                if (!name.equalsIgnoreCase("format") && !name.equalsIgnoreCase("sort")) {
     387                        FrameUtils.LeavingFrame(source);
     388                }
    384389
    385390                try {
  • trunk/src/org/expeditee/agents/DisplayComet.java

    r98 r103  
    2626        protected Frame process(Frame frame) {
    2727                Collection<String> seen = new HashSet<String>();
     28               
     29                DisplayIO.addToBack(frame);
     30               
    2831                // Goto the end of the comet
    2932                Item old = null;
    3033                Frame oldFrame = frame;
    3134                while (oldFrame != null) {
     35                        if(_stop)
     36                                return null;
    3237                        seen.add(oldFrame.getName().toLowerCase());
    3338                        _frameList.push(oldFrame);
     
    4651                // Back out one frame at a time
    4752                while (!_frameList.empty()) {
     53                        if(_stop)
     54                                return null;
    4855                        DisplayIO.setCurrentFrame(_frameList.pop());
    4956                        _frameCount++;
  • trunk/src/org/expeditee/gui/DisplayIO.java

    r97 r103  
    5858         * The title to display in the Title bar.
    5959         */
    60         public static final String TITLE = "Exp10Jun2008A";
     60        public static final String TITLE = "Exp13Jun2008A";
    6161
    6262        private DisplayIO() {
  • trunk/src/org/expeditee/gui/FrameUtils.java

    r102 r103  
    579579                        if (!item.isAnnotation())
    580580                                continue;
    581                        
    582                         String attribute = AttributeUtils.getAttribute(item.getText());
    583                         if(attribute == null || attribute.length() < 3)
     581
     582                        String attributeFullCase = AttributeUtils.getAttribute(item
     583                                        .getText());
     584                        // TODO Change the line below so that it does not complain for built
     585                        // in attributes
     586                        if (attributeFullCase == null || attributeFullCase.length() < 4)
    584587                                continue;
    585                         attribute = attribute.substring(1).toLowerCase();
    586                        
     588                        String attribute = attributeFullCase.substring(1).toLowerCase();
     589
    587590                        if (attribute.equals("homeframe")) {
    588591                                String first = getLink(item, UserSettings.FirstFrame);
     
    593596                                // warn the user
    594597                                else {
    595                                         //FrameGraphics.WarningMessage("Home frame: " + first
    596                                         //              + " is not a valid frame.");
     598                                        // FrameGraphics.WarningMessage("Home frame: " + first
     599                                        // + " is not a valid frame.");
    597600                                        UserSettings.FirstFrame = profile.getName();
    598601                                }
     
    627630                        } else if (attribute.equals("logging")) {
    628631                                UserSettings.Logging = getBoolean(item, UserSettings.Logging);
    629                         } else if (attribute.equals(
    630                                         "itemtemplate")) {
     632                        } else if (attribute.equals("itemtemplate")) {
    631633                                UserSettings.ItemTemplate = ((Text) item).getTemplateForm();
    632                         } else if (attribute.equals(
    633                                         "annotationtemplate")) {
     634                        } else if (attribute.equals("annotationtemplate")) {
    634635                                UserSettings.AnnotationTemplate = ((Text) item)
    635636                                                .getTemplateForm();
    636                         } else if (attribute.equals(
    637                                         "statstemplate")) {
     637                        } else if (attribute.equals("statstemplate")) {
    638638                                UserSettings.StatTemplate = ((Text) item).getTemplateForm();
    639                         } else if (attribute.equals(
    640                                         "commenttemplate")) {
     639                        } else if (attribute.equals("commenttemplate")) {
    641640                                UserSettings.CodeCommentTemplate = ((Text) item)
    642641                                                .getTemplateForm();
    643                         } else if (attribute.equals(
    644                                         "linetemplate")) {
     642                        } else if (attribute.equals("linetemplate")) {
    645643                                UserSettings.LineTemplate = ((Text) item).getTemplateForm();
    646644                        } else if (attribute.equals("framesetdir")) {
    647645                                String dir = getDir(item, null);
    648                                 if (dir != null){
     646                                if (dir != null) {
    649647                                        UserSettings.FrameDirs.add(dir);
    650648                                }
     
    668666                                UserSettings.FrameDirs.addAll(getDirs(item));
    669667                        } else {
    670                                 FrameGraphics.WarningMessage("[" + item.getText() + "]" + " is not a profile frame tag");
     668                                FrameGraphics.WarningMessage(attributeFullCase
     669                                                + " is not a profile frame tag");
    671670                        }
    672671                }
     
    761760                                else
    762761                                        return name + File.separator;
    763                         }else{
     762                        } else {
    764763                                FrameGraphics.ErrorMessage("Directory not found: " + name);
    765764                        }
    766                 }else{
    767                         FrameGraphics.WarningMessage("Missing value for profile attribute" + name);
     765                } else {
     766                        FrameGraphics.WarningMessage("Missing value for profile attribute"
     767                                        + name);
    768768                }
    769769                return alt;
     
    870870                                i.Permission = permissionLevel;
    871871                                if (i instanceof Text && i.isAnnotation()) {
    872                                         if (ItemUtils.startsWithTag(i,
    873                                                         ItemUtils.TAG_POINTTYPE)) {
     872                                        if (ItemUtils.startsWithTag(i, ItemUtils.TAG_POINTTYPE)) {
    874873                                                Text txt = (Text) i;
    875874                                                String line = txt.getFirstLine();
     
    896895                                        else if (ItemUtils.startsWithTag(i, ItemUtils.TAG_VECTOR)
    897896                                                        && i.getLink() != null) {
     897                                                // TODO It is possible to get into an infinate loop if a
     898                                                // frame contains an @ao which leads to a frame with an
     899                                                // @v which points back to the frame with the @ao
     900
    898901                                                Frame vector = FrameIO.LoadFrame(i.getAbsoluteLink());
    899902                                                if (vector != null) {
     
    913916                                        else if (ItemUtils.startsWithTag(i, ItemUtils.TAG_OVERLAY)
    914917                                                        && i.getLink() != null) {
     918                                                if (i.getAbsoluteLink().equalsIgnoreCase(
     919                                                                toParse.getName())) {
     920                                                        // This frame contains an active overlay which
     921                                                        // points to itself
     922                                                        FrameGraphics.ErrorMessage(toParse.getName()
     923                                                                        + " contains an @o which links to itself");
     924                                                        continue;
     925                                                }
     926
    915927                                                Frame overlay = FrameIO.LoadFrame(i.getAbsoluteLink());
    916928                                                // Parse(overlay);
     
    924936                                                        && i.getLink() != null) {
    925937                                                String link = i.getAbsoluteLink();
     938                                                if (link.equalsIgnoreCase(toParse.getName())) {
     939                                                        // This frame contains an active overlay which
     940                                                        // points to itself
     941                                                        FrameGraphics.ErrorMessage(toParse.getName()
     942                                                                        + " contains an @ao which links to itself");
     943                                                        continue;
     944                                                }
    926945                                                Frame overlay = FrameIO.LoadFrame(link);
    927946                                                // Parse(overlay);
     
    975994                                                        }
    976995                                                }
    977                                                 //TODO decide exactly what to do here!!
     996                                                // TODO decide exactly what to do here!!
    978997                                                toParse.addAnnotation((Text) i);
    979998                                        }
     
    14181437                                for (File helpFrameset : helpFramesets) {
    14191438                                        String framesetName = helpFrameset.getName();
    1420                                         if(!FrameIO.isValidFramesetName(framesetName))
     1439                                        if (!FrameIO.isValidFramesetName(framesetName))
    14211440                                                continue;
    14221441                                        Frame indexFrame = FrameIO.LoadFrame(framesetName + '1');
  • trunk/src/org/expeditee/stats/CometStats.java

    r90 r103  
    5656
    5757                StringBuffer sb = new StringBuffer();
     58                sb.append(SessionStats.getDate());
    5859                sb.append("CometName: ").append(_name).append('\n');
    59                 sb.append("Edits: ").append(_sessions).append('\n');
     60                sb.append("Versions: ").append(_sessions).append('\n');
    6061                sb.append("            Current  | Average  | Total").append('\n');
    6162                Time averageActive = new Time((long) (0.5 + active.getTime()
  • trunk/src/org/expeditee/stats/SessionStats.java

    r90 r103  
    8989
    9090        public static String getCurrentStats() {
    91                 StringBuffer stats = getSessionDateTime();
     91                StringBuffer stats = getLength();
    9292
    9393                long elapsedTime = (new Date()).getTime() - _StartTime.getTime();
     
    107107
    108108        private static String getTimeElapsed() {
    109                 SimpleDateFormat formatter = new SimpleDateFormat("HH:mm");
    110109                Date currentTime = new Date();
    111110                long elapsedTime = currentTime.getTime() - _StartTime.getTime();
    112                 String time = formatter.format(_StartTime);
    113                 time += "-->" + formatter.format(currentTime);
    114                 time += " = " + (int) (elapsedTime / MILLISECONDS_PER_MINUTE); // (new
     111                String time = "" + (int) ((double)elapsedTime / MILLISECONDS_PER_MINUTE + 0.5); // (new
    115112                // SimpleDateFormat("m").format(elapsedTime));
    116113
     
    260257                if (_StatsEnabled) {
    261258                        _AccessedFrames++;
    262                         _FrameEvents.clear();
    263                         _FrameAccessTime = new Date();
    264                         _FrameAccessDarkTime = (Time) _DarkTime.clone();
    265259                }
    266260        }
     
    269263                FrameEdited(frameName);
    270264                _SavedFrames++;
     265               
     266                _FrameEvents.clear();
     267                _FrameAccessTime = new Date();
     268                _FrameAccessDarkTime = (Time) _DarkTime.clone();
    271269        }
    272270
     
    350348
    351349        private static void FrameEdited(String name) {
    352                 _FramesEdited.append(Logger.EasyDateFormat("ddMMMyyyy-HHmm:ss"))
     350                _FramesEdited.append(Logger.EasyDateFormat("ddMMMyyyy:HHmm:ss"))
    353351                                .append("[").append(name).append("]\n");
    354352        }
     
    402400
    403401        public static String getItemStats() {
    404                 StringBuffer stats = getSessionDateTime();
     402                StringBuffer stats = getLength();
    405403                int max = 0;
    406404                for (int i = 0; i < STAT_TYPES; i++) {
     
    436434
    437435        public static String getEventStats() {
    438                 StringBuffer stats = getSessionDateTime();
     436                StringBuffer stats = getLength();
    439437                int max = getMax(_EventTimes);
    440438                int maxWidthEvents = ("" + max).length();
     
    485483         * @return
    486484         */
    487         private static StringBuffer getSessionDateTime() {
     485        public static StringBuffer getLength() {
     486                StringBuffer stats = getDate();
     487                stats.append("SessionTime: ").append(getTimeElapsed()).append("\n");
     488                return stats;
     489        }
     490       
     491        public static StringBuffer getDate() {
    488492                StringBuffer stats = new StringBuffer("Date: ");
    489                 stats.append(Logger.EasyDateFormat("ddMMMyyyy")).append("\n");
    490                 stats.append("SessionTime: ").append(getTimeElapsed()).append("\n");
     493                stats.append(Logger.EasyDateFormat("ddMMMyyyy:HHmm")).append("\n");
    491494                return stats;
    492495        }
  • trunk/src/org/expeditee/stats/TreeStats.java

    r102 r103  
    6868
    6969                StringBuffer sb = new StringBuffer();
     70                sb.append(SessionStats.getDate());
    7071                sb.append("TopFrame: ").append(_name).append('\n');
    7172                sb.append("Frames:   ").append(_treeFrames).append('\n');
    7273                sb.append("Versions: ").append(_treeSessions).append('\n');
    73                 sb.append("            FrameAve |VersionAve| Total").append('\n');
     74                sb.append("           VersionAve| FrameAve | Total").append('\n');
    7475                Time averageActive = new Time((long) (0.5 + active.getTime()
    7576                                / (1.0 * _treeFrames)));
Note: See TracChangeset for help on using the changeset viewer.