public abstract class AutocompletionClient extends Object implements IContentProposalProvider
Initialize the method using the query field and pass it on to the
ContentProposalAdapter
.
getProposals(String, int)
returns rather fast, so this method could
be used with a short activation delay.
This implementation should circumvent TG-548 although there is currently no support for slow completion code in Eclipse (TG-548: Lags while entering metadata (e.g. in the import dialog) https://develop.sub.uni-goettingen.de/jira/browse/TG-548).
The first call to getProposals(query, position) will initiate an
auto-completion query for query.subString(0, position)
in the
background. Further calls will check whether the new query is a
substring of that background request. If yes, they will return those of the
results the background job has already fetched that match the new
query. Otherwise, a new request will be started.
In any case, this method returns immediately at the cost of returning an incomplete or empty list of completions.
Modifier and Type | Field and Description |
---|---|
protected ExtendedContentProposalAdapter |
contentProposalAdapter |
protected static IContentProposal[] |
NONE |
protected AbstractRequest |
request |
protected String |
whereToComplete |
Constructor and Description |
---|
AutocompletionClient(String whichField)
Constructor: set the element of metadata (e.g.
|
Modifier and Type | Method and Description |
---|---|
protected abstract AbstractRequest |
createRequest(String whereToComplete,
String query) |
protected void |
forceOpenPopupIfClosed() |
ExtendedContentProposalAdapter |
getContentProposalAdapter() |
protected info.textgrid.lab.search.AutocompletionClient.ContentProposalConvertor |
getContentProposalConvertor() |
protected org.apache.axiom.om.OMElement |
getHttpResponse(String url,
String query) |
protected int |
getMinimalLength()
How many characters should be given before beginning the search process.
|
IContentProposal[] |
getProposals(String contents,
int position) |
void |
setContentProposalAdapter(ExtendedContentProposalAdapter contentProposalAdapter) |
void |
setWhereToComplete(String field)
Set (or modify) the element of metadata (e.g.
|
protected ExtendedContentProposalAdapter contentProposalAdapter
protected static final IContentProposal[] NONE
protected String whereToComplete
protected AbstractRequest request
public AutocompletionClient(String whichField)
whichField
- public ExtendedContentProposalAdapter getContentProposalAdapter()
public void setContentProposalAdapter(ExtendedContentProposalAdapter contentProposalAdapter)
public void setWhereToComplete(String field)
field
- protected abstract AbstractRequest createRequest(String whereToComplete, String query)
protected int getMinimalLength()
public IContentProposal[] getProposals(String contents, int position)
getProposals
in interface IContentProposalProvider
protected info.textgrid.lab.search.AutocompletionClient.ContentProposalConvertor getContentProposalConvertor()
protected org.apache.axiom.om.OMElement getHttpResponse(String url, String query) throws org.apache.commons.httpclient.HttpException, IOException, XMLStreamException, FactoryConfigurationError
org.apache.commons.httpclient.HttpException
IOException
XMLStreamException
FactoryConfigurationError
protected void forceOpenPopupIfClosed()