Ignore:
Timestamp:
10/10/08 11:05:28 (16 years ago)
Author:
ra33
Message:

Added Spell Checker
Added word count stats
Fixed some mail stuff

Location:
trunk/src/org/expeditee/agents
Files:
2 added
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/expeditee/agents/MailTree.java

    r311 r362  
    44import java.util.Map;
    55
     6import org.expeditee.actions.Misc;
    67import org.expeditee.agents.mail.MailSession;
    78import org.expeditee.gui.AttributeValuePair;
     
    910import org.expeditee.gui.FrameIO;
    1011import org.expeditee.gui.FreeItems;
     12import org.expeditee.io.Logger;
    1113import org.expeditee.items.Item;
    1214import org.expeditee.items.Text;
     
    159161                }
    160162
     163                FreeItems.getInstance().clear();
     164               
     165                //Produce output for the user to put down on their frame
     166                StringBuffer sb = new StringBuffer();
     167                sb.append("@Sent: ").append(Logger.EasyDateFormat(Logger.LONG_DATE_FORMAT));
     168               
     169                if(to != null){
     170                        sb.append("\nTo: " + to);
     171                }
     172               
     173                if(cc != null){
     174                        sb.append("\nCc: " + cc);
     175                }
     176               
     177                if(bcc != null){
     178                        sb.append("\nBcc: " + bcc);
     179                }
     180               
     181                Misc.attachStatsToCursor(sb.toString());
     182               
    161183                // Last chance for the user to stop
    162184                if (_stop)
  • trunk/src/org/expeditee/agents/SearchAgent.java

    r298 r362  
    1313        private static final String DEFAULT_RESULTS_FRAMESET = "SearchResults";
    1414
     15        public static final int SURROGATE_LENGTH = 50;
     16
    1517        protected FrameCreator _results;
    1618
     
    2224
    2325        public SearchAgent(String searchText) {
    24                 _pattern = searchText;
     26                _pattern = searchText.toLowerCase();
    2527        }
    2628
  • trunk/src/org/expeditee/agents/SearchFrameset.java

    r313 r362  
    2727                        String frameName = _startName + i;
    2828                        overwriteMessage("Searching " + frameName);
    29                         searchFrame(_results, frameName, _pattern,
    30                                         _replacementString);
     29                        if(searchFrame(_results, frameName, _pattern,
     30                                        _replacementString))
     31                                _frameCount++;
    3132                }
    3233                _results.save();
  • trunk/src/org/expeditee/agents/SearchFramesetFast.java

    r313 r362  
    1717                _maxFrame = maxFrame;
    1818        }
    19        
     19
    2020        public SearchFramesetFast(String searchText) {
    2121                super(searchText);
     
    2424        @Override
    2525        protected Frame process(Frame frame) {
    26                 if(frame == null) {
     26                if (frame == null) {
    2727                        frame = FrameIO.LoadFrame(_startName + '0');
    2828                }
    2929                String path = frame.getPath();
    30                
     30
    3131                int count = FrameIO.getLastNumber(_startName);
    32                 for (long i = _firstFrame;i <= _maxFrame && i <= count; i++) {
     32                for (long i = _firstFrame; i <= _maxFrame && i <= count; i++) {
    3333                        if (_stop) {
    3434                                break;
     
    3636                        String frameName = _startName + i;
    3737                        overwriteMessage("Searching " + frameName);
    38                         Collection<String> found = FrameIO.searchFrame(frameName, _pattern, path);
    39                         int size = found == null? 0 :found.size();
     38                        Collection<String> found = FrameIO.searchFrame(frameName, _pattern,
     39                                        path);
     40                        int size = found == null ? 0 : found.size();
    4041                        // If the frame exists
    41                         if(found != null)
     42                        if (found != null)
    4243                                _frameCount++;
    43                         if(size > 0){
    44                                 String repeats = size > 1? ("("+ size+ ")") : "";
    45                                 _results.addText(frameName + repeats, null, frameName, null, false);
    46                                 FrameGraphics.requestRefresh(true);
     44                        if (size > 0) {
     45                                // String repeats = size > 1? ("("+ size+ ")") : "";
     46                                for (String s : found) {
     47                                        StringBuffer surrogate = new StringBuffer();
     48                                        surrogate.append("[").append(i).append("] ");
     49                                        if (s.length() > SearchAgent.SURROGATE_LENGTH)
     50                                                surrogate.append(
     51                                                                s.substring(0, SearchAgent.SURROGATE_LENGTH - 3))
     52                                                                .append("...");
     53                                        else {
     54                                                surrogate.append(s);
     55                                        }
     56
     57                                        _results.addText(surrogate.toString(), null,
     58                                                        frameName, null, false);
     59                                        FrameGraphics.requestRefresh(true);
     60                                }
    4761                        }
    4862                }
  • trunk/src/org/expeditee/agents/mail/MailSession.java

    r348 r362  
    207207                                                for (;;) {
    208208                                                        try {
    209                                                                 Thread.sleep(2000);
     209                                                                Thread.sleep(5000);
    210210                                                                /*
    211211                                                                 * sleep for freq milliseconds. This is to force
     
    505505                                try {
    506506                                        String subject = message.getSubject();
    507                                         source.setText(" " + messageNo + ". " + subject);
     507                                        source.setText("[" + messageNo + "] " + subject);
    508508                                        // Create a frameCreator
    509509                                        final FrameCreator frames = new FrameCreator(frame
     
    562562                                                                new InputStreamReader(is));
    563563                                                String thisLine = reader.readLine();
     564                                                StringBuffer nextText = new StringBuffer();
    564565                                                while (thisLine != null) {
    565                                                         frames.addText(thisLine, null, null, null, false);
     566                                                        // A blank line is a signal to start a new text item
     567                                                        if (thisLine.trim() == "") {
     568                                                                addTextItem(frames, nextText.toString());
     569                                                                nextText = new StringBuffer();
     570                                                        } else {
     571                                                                nextText.append(thisLine).append('\n');
     572                                                        }
    566573                                                        thisLine = reader.readLine();
    567574                                                }
     575                                                addTextItem(frames, nextText.toString());
    568576                                        }
    569577                                        message.setFlag(Flag.SEEN, true);
     
    579587                                        e.printStackTrace();
    580588                                }
     589                        }
     590
     591                        /**
     592                         * @param frames
     593                         * @param nextText
     594                         */
     595                        private void addTextItem(final FrameCreator frames, String nextText) {
     596                                nextText = nextText.trim();
     597                                if (nextText.length() == 0)
     598                                        return;
     599
     600                                frames.addText(nextText.substring(0, nextText.length() - 1),
     601                                                null, null, null, false);
    581602                        }
    582603                }.start();
Note: See TracChangeset for help on using the changeset viewer.