Ignore:
Timestamp:
09/04/08 17:07:39 (16 years ago)
Author:
ra33
Message:
 
Location:
trunk/src/org/expeditee/agents
Files:
2 edited

Legend:

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

    r199 r294  
    3030
    3131        public Format() {
     32                super();
    3233        }
    3334
  • trunk/src/org/expeditee/agents/SearchAgent.java

    r292 r294  
    1212
    1313        private static final String DEFAULT_RESULTS_FRAMESET = "SearchResults";
    14        
     14
    1515        protected FrameCreator _results;
    1616
     
    1818
    1919        protected String _replacementString;
    20        
     20
    2121        protected String _startName;
    2222
     
    2424                _pattern = searchText;
    2525        }
    26        
     26
    2727        @Override
    2828        public boolean initialise(Frame frame, Item item) {
    2929                String pattern = item.getText();
    3030                String resultFrameset = null;
    31                
    32                 //TODO use a results frame specified on the profile frame
     31
     32                // TODO use a results frame specified on the profile frame
    3333                if (item.getLink() == null) {
    3434                        resultFrameset = DEFAULT_RESULTS_FRAMESET;
     
    3737                                        false);
    3838                }
    39                 return initialise(frame, item, frame.getFramesetName(), resultFrameset, null, pattern);
     39                return initialise(frame, item, frame.getFramesetName(), resultFrameset,
     40                                null, pattern);
    4041        }
    4142
    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();
    4560                _replacementString = replacementString;
    4661                _startName = startName;
     
    4863                // Create a frame to put the results on with the search query
    4964                // and type as the title
    50                 String title = this.getClass().getSimpleName() + " [" + startName + "] [" + pattern
    51                                 + "]";
     65                String title = this.getClass().getSimpleName() + " [" + startName
     66                                + "] [" + _pattern + "]";
    5267                _results = new FrameCreator(resultsFrameset, null, title, false, true);
    5368                // Set the frame to be displayed after running the agent
    5469                _end = _results.getFirstFrame();
    55                
     70
    5671                return super.initialise(frame, item);
    5772        }
    58        
     73
    5974        public String getResultsFrameName() {
    6075                return _results.getName();
    6176        }
    62        
     77
    6378        public static boolean searchItem(Text itemToSearch, String pattern,
    6479                        String replacementString) {
     
    85100                        // Search for the item and add it to the results page if
    86101                        // it is found
    87                         if (searchItem(itemToSearch, pattern,
    88                                         replacementString)) {
     102                        if (searchItem(itemToSearch, pattern, replacementString)) {
    89103                                // Add a linked item to the results frame
    90104                                results.addText(frameName, null, frameName, null, false);
Note: See TracChangeset for help on using the changeset viewer.