Changeset 362 for trunk/src/org/expeditee/agents
- Timestamp:
- 10/10/08 11:05:28 (16 years ago)
- Location:
- trunk/src/org/expeditee/agents
- Files:
-
- 2 added
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/expeditee/agents/MailTree.java
r311 r362 4 4 import java.util.Map; 5 5 6 import org.expeditee.actions.Misc; 6 7 import org.expeditee.agents.mail.MailSession; 7 8 import org.expeditee.gui.AttributeValuePair; … … 9 10 import org.expeditee.gui.FrameIO; 10 11 import org.expeditee.gui.FreeItems; 12 import org.expeditee.io.Logger; 11 13 import org.expeditee.items.Item; 12 14 import org.expeditee.items.Text; … … 159 161 } 160 162 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 161 183 // Last chance for the user to stop 162 184 if (_stop) -
trunk/src/org/expeditee/agents/SearchAgent.java
r298 r362 13 13 private static final String DEFAULT_RESULTS_FRAMESET = "SearchResults"; 14 14 15 public static final int SURROGATE_LENGTH = 50; 16 15 17 protected FrameCreator _results; 16 18 … … 22 24 23 25 public SearchAgent(String searchText) { 24 _pattern = searchText ;26 _pattern = searchText.toLowerCase(); 25 27 } 26 28 -
trunk/src/org/expeditee/agents/SearchFrameset.java
r313 r362 27 27 String frameName = _startName + i; 28 28 overwriteMessage("Searching " + frameName); 29 searchFrame(_results, frameName, _pattern, 30 _replacementString); 29 if(searchFrame(_results, frameName, _pattern, 30 _replacementString)) 31 _frameCount++; 31 32 } 32 33 _results.save(); -
trunk/src/org/expeditee/agents/SearchFramesetFast.java
r313 r362 17 17 _maxFrame = maxFrame; 18 18 } 19 19 20 20 public SearchFramesetFast(String searchText) { 21 21 super(searchText); … … 24 24 @Override 25 25 protected Frame process(Frame frame) { 26 if (frame == null) {26 if (frame == null) { 27 27 frame = FrameIO.LoadFrame(_startName + '0'); 28 28 } 29 29 String path = frame.getPath(); 30 30 31 31 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++) { 33 33 if (_stop) { 34 34 break; … … 36 36 String frameName = _startName + i; 37 37 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(); 40 41 // If the frame exists 41 if (found != null)42 if (found != null) 42 43 _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 } 47 61 } 48 62 } -
trunk/src/org/expeditee/agents/mail/MailSession.java
r348 r362 207 207 for (;;) { 208 208 try { 209 Thread.sleep( 2000);209 Thread.sleep(5000); 210 210 /* 211 211 * sleep for freq milliseconds. This is to force … … 505 505 try { 506 506 String subject = message.getSubject(); 507 source.setText(" " + messageNo + "." + subject);507 source.setText("[" + messageNo + "] " + subject); 508 508 // Create a frameCreator 509 509 final FrameCreator frames = new FrameCreator(frame … … 562 562 new InputStreamReader(is)); 563 563 String thisLine = reader.readLine(); 564 StringBuffer nextText = new StringBuffer(); 564 565 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 } 566 573 thisLine = reader.readLine(); 567 574 } 575 addTextItem(frames, nextText.toString()); 568 576 } 569 577 message.setFlag(Flag.SEEN, true); … … 579 587 e.printStackTrace(); 580 588 } 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); 581 602 } 582 603 }.start();
Note:
See TracChangeset
for help on using the changeset viewer.