| java.lang.Object isql.ClassMethodTabExpander
ClassMethodTabExpander | public class ClassMethodTabExpander implements ITabExpander(Code) | | This expander class expands a given word, based on a given data model.
This would typically be used by a Document, but could be used
from anywhere where Tab expansion is required.
This implementation uses a TabModel object which can be customized by
caller.
For convenience, a constructir with a String[] argument has been
created.
Following are examples of usage:
// MyTabModel implements TabModel with your custom data structure.
ETabExpander et = ETabExpander(new MyTabModel());
String exp = et.getNextExpansion(pattern);
// or
// myArray would be populated from a file or database
String myArray[] = new String[] {"abc","def", ...};
ETabExpander et = ETabExpander(myArray);
String exp = et.getNextExpansion(pattern);
// or
ETabExpander et = ETabExpander();
et.setModel(ETabExpander.createTabModel(myArray));
String exp = et.getNextExpansion(pattern);
author: rahul kumar, 2001 $Author: rahul_kumar $ author: $Id: ClassMethodTabExpander.java,v 1.2 2004/01/01 07:01:03 rahul_kumar Exp $ |
_matchedindex | protected int _matchedindex(Code) | | stores the index in _arrMatched of the last word shown to user
|
_pattern | protected String _pattern(Code) | | stores the current word typed by user on which we are tabbing.
We would revert to this word if he doesnt accept any substitution
|
ClassMethodTabExpander | public ClassMethodTabExpander(Map cache, Map htPackageClasses)(Code) | | |
ClassMethodTabExpander | public ClassMethodTabExpander(TabModel tm)(Code) | | |
ClassMethodTabExpander | public ClassMethodTabExpander()(Code) | | |
createTabModel | public static TabModel createTabModel(Map htClassMethods, Map htPackageClasses)(Code) | | convenience method for creating a TabModel based on a
Map. May be used to initialize the Expander if constructed
without parameters, or just for updating model.
|
expand | public String expand(String patt, int index)(Code) | | expands the given pattern, returning the match at count
position. USer would start with 0, and continue till null is
returned.
|
getExpansions | public String[] getExpansions()(Code) | | returns all expansions for the previously searched pattern
|
getExpansions | public String[] getExpansions(String patt)(Code) | | returns expansions for the given string. Has no impact on
existing searches.
|
getModel | public TabModel getModel()(Code) | | returns the installed model, which may be updated by caller.
|
getNextExpansion | public String getNextExpansion(String patt)(Code) | | returns expansions for a string. Caller would just send in a
string and keep calling this until a null is returned.
Caller would either call getNextExpansion or expand, whatever
suits his needs better.
|
|
|