jgnash.ui.components.autocomplete
Class DefaultAutoCompleteModel

java.lang.Object
  extended by jgnash.ui.components.autocomplete.DefaultAutoCompleteModel
All Implemented Interfaces:
AutoCompleteModel
Direct Known Subclasses:
AutoCompleteFactory.TransactionModel

public class DefaultAutoCompleteModel
extends java.lang.Object
implements AutoCompleteModel

Default model for auto complete search.

Version:
$Id$
Author:
Craig Cavanaugh, Don Brown

Field Summary
private  java.util.List<java.lang.String> list
           
 
Constructor Summary
DefaultAutoCompleteModel()
           
 
Method Summary
 void addString(java.lang.String content)
           
 java.lang.String doLookAhead(java.lang.String content)
          Performs a search to find the best matching String to the supplied String.
 java.lang.Object getExtraInfo(java.lang.String key)
          Returns extra information that might be stored with a found string returned by doLookAhead().
 void purge()
          Removes all of the string that have been remembered
private static boolean startsWithIgnoreCase(java.lang.String source, java.lang.String prefix)
          Tests if the source string starts with the prefix string.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

list

private final java.util.List<java.lang.String> list
Constructor Detail

DefaultAutoCompleteModel

public DefaultAutoCompleteModel()
Method Detail

doLookAhead

public java.lang.String doLookAhead(java.lang.String content)
Performs a search to find the best matching String to the supplied String. Returns null if nothing is found. The search is not case sensitive.

Specified by:
doLookAhead in interface AutoCompleteModel
Parameters:
content - content to search for
Returns:
string that was found if any

addString

public void addString(java.lang.String content)

purge

public void purge()
Removes all of the string that have been remembered


getExtraInfo

public java.lang.Object getExtraInfo(java.lang.String key)
Returns extra information that might be stored with a found string returned by doLookAhead(). This information can be used to populate other fields based on matching the string key.

Specified by:
getExtraInfo in interface AutoCompleteModel
Parameters:
key - The string key most likely returned from doLookAhead()
Returns:
null

startsWithIgnoreCase

private static boolean startsWithIgnoreCase(java.lang.String source,
                                            java.lang.String prefix)
Tests if the source string starts with the prefix string. Case is ignored.

Parameters:
source - the source String.
prefix - the prefix String.
Returns:
true, if the source starts with the prefix string.