Changeset 294 for trunk/src/org/expeditee/agents
- Timestamp:
- 09/04/08 17:07:39 (16 years ago)
- Location:
- trunk/src/org/expeditee/agents
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/expeditee/agents/Format.java
r199 r294 30 30 31 31 public Format() { 32 super(); 32 33 } 33 34 -
trunk/src/org/expeditee/agents/SearchAgent.java
r292 r294 12 12 13 13 private static final String DEFAULT_RESULTS_FRAMESET = "SearchResults"; 14 14 15 15 protected FrameCreator _results; 16 16 … … 18 18 19 19 protected String _replacementString; 20 20 21 21 protected String _startName; 22 22 … … 24 24 _pattern = searchText; 25 25 } 26 26 27 27 @Override 28 28 public boolean initialise(Frame frame, Item item) { 29 29 String pattern = item.getText(); 30 30 String resultFrameset = null; 31 32 // TODO use a results frame specified on the profile frame31 32 // TODO use a results frame specified on the profile frame 33 33 if (item.getLink() == null) { 34 34 resultFrameset = DEFAULT_RESULTS_FRAMESET; … … 37 37 false); 38 38 } 39 return initialise(frame, item, frame.getFramesetName(), resultFrameset, null, pattern); 39 return initialise(frame, item, frame.getFramesetName(), resultFrameset, 40 null, pattern); 40 41 } 41 42 42 public boolean initialise(Frame frame, Item item, String startName, String resultsFrameset, 43 String replacementString, String pattern) { 44 _pattern = pattern.toLowerCase(); 43 /** 44 * 45 * @param frame 46 * @param item 47 * @param startName 48 * @param resultsFrameset 49 * @param replacementString 50 * @param pattern 51 * is ignored if the pattern has already been set earlier. 52 * @return 53 */ 54 public boolean initialise(Frame frame, Item item, String startName, 55 String resultsFrameset, String replacementString, String pattern) { 56 //TODO: Put the init params in the constructor!! Dont want to be setting _pattern in two places! 57 58 if (_pattern == null) 59 _pattern = pattern.toLowerCase(); 45 60 _replacementString = replacementString; 46 61 _startName = startName; … … 48 63 // Create a frame to put the results on with the search query 49 64 // and type as the title 50 String title = this.getClass().getSimpleName() + " [" + startName + "] [" + pattern51 + "] ";65 String title = this.getClass().getSimpleName() + " [" + startName 66 + "] [" + _pattern + "]"; 52 67 _results = new FrameCreator(resultsFrameset, null, title, false, true); 53 68 // Set the frame to be displayed after running the agent 54 69 _end = _results.getFirstFrame(); 55 70 56 71 return super.initialise(frame, item); 57 72 } 58 73 59 74 public String getResultsFrameName() { 60 75 return _results.getName(); 61 76 } 62 77 63 78 public static boolean searchItem(Text itemToSearch, String pattern, 64 79 String replacementString) { … … 85 100 // Search for the item and add it to the results page if 86 101 // it is found 87 if (searchItem(itemToSearch, pattern, 88 replacementString)) { 102 if (searchItem(itemToSearch, pattern, replacementString)) { 89 103 // Add a linked item to the results frame 90 104 results.addText(frameName, null, frameName, null, false);
Note:
See TracChangeset
for help on using the changeset viewer.