|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectnet.rim.device.api.ui.Field
net.rim.device.api.ui.component.ListField
net.rim.device.api.ui.component.KeywordFilterField
public class KeywordFilterField
Consists of a single keyword input field and a list of selectable elements. The elements are filtered
when keywords are entered into the input field. An example of this can be found in the Address Book
application. The KeywordFilterField itself is a ListField and can be added to any
container for layout purposes. The contents within this list represent the keyword filter results.
The keyword input field can be access via getKeywordField or overridden with
a custom TextField via setKeywordField. This field currently only supports
prefix keyword filtering.
| Field Summary |
|---|
| Fields inherited from class net.rim.device.api.ui.component.ListField |
|---|
MULTI_SELECT, NON_CONTIGUOUS_SELECT, NO_ALTED_PAGE_UP_DOWN, ROW_HEIGHT_FONT |
| Fields inherited from interface net.rim.device.api.ui.FieldChangeListener |
|---|
PROGRAMMATIC |
| Constructor Summary | ||
|---|---|---|
KeywordFilterField()
Creates a new KeywordFilterField. |
||
| Method Summary | ||
|---|---|---|
Object |
getElementAt(int index)
Retrieves the element at the specified index in the list. |
|
String |
getKeyword()
Retrieves the entered keyword. |
|
TextField |
getKeywordField()
Retrieves the keyword input field. |
|
String |
getLabel()
Retrieves the label preceding the keyword input area. |
|
ReadableList |
getResultList()
Retrieves the list of elements that are currently not filtered out, i.e. search results. |
|
int |
getResultListSize()
Retrieves the size of the list of elements that are currently not filtered out. |
|
Object |
getSelectedElement()
Retrieves the selected element in the results list. |
|
ReadableList |
getSourceList()
Retrieves the source collection list. |
|
void |
setKeyword(String keyword)
Sets a keyword in the keyword input field programmatically. |
|
void |
setKeywordField(TextField keywordField)
Sets a custom keyword input field, which overrides the default field. |
|
void |
setLabel(String label)
Sets the keyword input field's label. |
|
void |
setSourceList(ReadableList list,
KeywordProvider helper)
Sets read-only source elements in the collection list from which to search. |
|
void |
updateList()
To be invoked if the contents of the source collection list change. |
|
| Methods inherited from class net.rim.device.api.ui.component.ListField |
|---|
delete, drawFocus, getAccessibleContext, getCallback, getEmptyString, getEmptyStringStyle, getFocusRect, getPreferredWidth, getRowHeight, getSelectedIndex, getSelection, getSize, indexOfList, insert, invalidate, invalidate, invalidateRange, isEmpty, keyChar, keyControl, layout, moveFocus, moveFocus, onFocus, paint, setCallback, setEmptyString, setEmptyString, setRowHeight, setSearchable, setSelectedIndex, setSize, setSize |
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface net.rim.device.api.ui.FieldChangeListener |
|---|
fieldChanged |
| Constructor Detail |
|---|
public KeywordFilterField()
KeywordFilterField.
Use setSourceList, setLabel (optional), setCallback (optional),
setKeywordField (optional) to initialize field.
| Method Detail |
|---|
public void setLabel(String label)
label - New label for the input field. Ignored if null.public void setKeywordField(TextField keywordField)
FieldChangeListener
for the custom keyword input field via Field#setChangeListener in order for searches to occur.
keywordField - Custom keyword input field. Resets to default text input field if null.
public void setSourceList(ReadableList list,
KeywordProvider helper)
ReadableList can contain any object.
list - New source collection list for the field.helper - New keyword provider helper.
NullPointerException - if the ReadableList passed in has null values in it.
IllegalArgumentException - In case parameters are set to null.
Exception - The same exception that KeywordProvider.getKeyword(Object) throws.public void updateList()
public void setKeyword(String keyword)
KeywordFilterField list is updated
with the search results, a FieldChangeListener
should be set via setChangeListener. A null keyword is equivalent
to an empty string and will reset the search. Note: This method will lock the source collection
list while the search is in progress.
keyword - New keyword to search.public ReadableList getResultList()
ReadableList containing the keyword
filtered elements shown in the list; if this KeywordFilterField is not set using setSourceList,
returns null. Note: If this method is invoked while the current search is still in progress then the result of prior search will be returned.
The result list is updated once the search is complete.public int getResultListSize()
setSourceList, returns 0.public Object getSelectedElement()
public Object getElementAt(int index)
index - Location of within the list.
public String getKeyword()
String containing the entered keyword. An empty string if no keyword is entered.public String getLabel()
setLabel
to change default label.
public ReadableList getSourceList()
setSourceList to set a list of elements in the field.
public TextField getKeywordField()
setKeywordField.
TextField representing the keyword input field.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
Copyright 1999-2010 Research In Motion Limited. 295 Phillip Street, Waterloo, Ontario, Canada, N2L 3W8. All Rights Reserved.
Copyright 1993-2003 Sun Microsystems, Inc. 901 San Antonio Road, Palo Alto, California, 94303, U.S.A. All Rights Reserved.
Copyright 2002-2003 Nokia Corporation All Rights Reserved.
Java is a trademark of Sun Microsystems, Inc.