|
|||||||||
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.ObjectListField
public class ObjectListField
List field to contain a list of objects.
Behaviour
Displays a list of objects. Each constructor builds a new ObjectListField,
and then registers this field as its own drawing callback object.
This class assumes that the contained objects can all provide string
representations of themselves (using Object.toString()
).
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.DrawStyle |
---|
BASELINE, BOTTOM, ELLIPSIS, HALIGN_MASK, HCENTER, HDEFAULT, HFULL, LEADING, LEFT, RIGHT, TOP, TRAILING, TRUNCATE_BEGINNING, VALIGN_MASK, VCENTER, VDEFAULT, VFULL |
Constructor Summary | ||
---|---|---|
ObjectListField()
Constructs an ObjectListField. |
||
ObjectListField(long style)
Constructs an ObjectListField in a particular style. |
Method Summary | ||
---|---|---|
void |
delete(int index)
Deletes row at specified index. |
|
void |
drawListRow(ListField listField,
Graphics graphics,
int index,
int y,
int width)
Invoked when a particular row requires repainting. |
|
Object |
get(ListField listField,
int index)
Retrieves an item from this field's list. |
|
int |
getPreferredWidth(ListField listField)
Retrieves preferred width of this field. |
|
int |
indexOfList(ListField listField,
String prefix,
int start)
Retrieves first occurrence of provided prefix in list. |
|
void |
insert(int index)
Inserts empty row at specified index. |
|
void |
insert(int index,
Object object)
Inserts an element in the list. |
|
protected void |
layout(int width,
int height)
Lays out this field's contents. |
|
void |
set(Object[] list)
Sets the list of objects to show. |
Methods inherited from class net.rim.device.api.ui.component.ListField |
---|
drawFocus, getAccessibleContext, getCallback, getEmptyString, getEmptyStringStyle, getFocusRect, getPreferredWidth, getRowHeight, getSelectedIndex, getSelection, getSize, indexOfList, invalidate, invalidate, invalidateRange, isEmpty, keyChar, keyControl, moveFocus, moveFocus, onFocus, paint, setCallback, setEmptyString, setEmptyString, setRowHeight, setSearchable, setSelectedIndex, setSize, setSize, trackwheelClick, trackwheelUnclick |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ObjectListField()
public ObjectListField(long style)
style
- Style(s) for this object list field.Method Detail |
---|
public void delete(int index)
delete
in class ListField
index
- Index of row to delete (each existing element in the list after
this index is pulled back one slot).public void drawListRow(ListField listField, Graphics graphics, int index, int y, int width)
This field's manager invokes this method when one of this field's rows requires repainting. The graphics context passed to this method represents the entire list, not just the row for repainting. Accordingly, the y parameter indicates how far down in the list the repaint should occur.
drawListRow
in interface ListFieldCallback
listField
- List field that requires repainting (this field).graphics
- Graphics context for this field.index
- Row index to display.y
- Distance from the top of this list field at which to start painting.width
- Width of this field.public Object get(ListField listField, int index)
This field's manager invokes this method when it must retrieve an item from this field's list.
get
in interface ListFieldCallback
listField
- List field from which to retrieve item (this field).index
- Row index containing desired item.
public int getPreferredWidth(ListField listField)
This field's manager invokes this method when it must retrieve this field's preferred width for layout purposes.
getPreferredWidth
in interface ListFieldCallback
listField
- List field for which to retrieve the preferred width
(this field).
public int indexOfList(ListField listField, String prefix, int start)
This field's manager invokes this method when it must do a prefix search on this list's contents. If this method reaches the end of the list before it can find a match for your prefix, it returns -1.
indexOfList
in interface ListFieldCallback
listField
- List field in which to search (this field).prefix
- Prefix to search for.start
- List item at which to commence the search.
public void insert(int index)
insert
in class ListField
index
- Index before which to insert (each existing element in the
list after this index is pushed down one slot).public void insert(int index, Object object)
index
- Index before which to insert the new element (each existing
element in the list after this index is pushed down one slot).object
- New object to insert into this list.protected void layout(int width, int height)
This field's manager invokes this method during the layout process to instruct this field to arrange its contents, given an amount of available space.
layout
in class ListField
width
- Amount of available horizontal space.height
- Amount of available vertical space.public void set(Object[] list)
list
- Objects to show in list.
|
|||||||||
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.